QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgshuesaturationfilter.h
Go to the documentation of this file.
1/***************************************************************************
2 qgshuesaturationfilter.h
3 -------------------
4 begin : February 2013
5 copyright : (C) 2013 by Alexander Bruy, Nyall Dawson
6 email : alexander dot bruy at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSHUESATURATIONFILTER_H
19#define QGSHUESATURATIONFILTER_H
20
21#include "qgis_core.h"
22#include "qgis_sip.h"
23#include "qgsrasterinterface.h"
24
25class QDomElement;
26
32{
33 public:
34 // Available modes for converting a raster to grayscale
42
44
46
47 int bandCount() const override;
48
49 Qgis::DataType dataType( int bandNo ) const override;
50
51 bool setInput( QgsRasterInterface *input ) override;
52
53 QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
54
55 void setSaturation( int saturation );
56 int saturation() const { return mSaturation; }
57
63 void setInvertColors( bool invertColors ) { mInvertColors = invertColors; }
64
69 bool invertColors() const { return mInvertColors; }
70
72 QgsHueSaturationFilter::GrayscaleMode grayscaleMode() const { return mGrayscaleMode; }
73
74 void setColorizeOn( bool colorizeOn ) { mColorizeOn = colorizeOn; }
75 bool colorizeOn() const { return mColorizeOn; }
76 void setColorizeColor( const QColor &colorizeColor );
77 QColor colorizeColor() const { return mColorizeColor; }
78 void setColorizeStrength( int colorizeStrength ) { mColorizeStrength = colorizeStrength; }
79 int colorizeStrength() const { return mColorizeStrength; }
80
81 void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
82
84 void readXml( const QDomElement &filterElem ) override;
85
86 private:
88 void processSaturation( int &r, int &g, int &b, int &h, int &s, int &l ) const;
90 void processColorization( int &r, int &g, int &b, int &h, int &s, int &l ) const;
91
93 int mSaturation = 0;
94 double mSaturationScale = 1;
95
98
99 bool mInvertColors = false;
100
102 bool mColorizeOn = false;
103 QColor mColorizeColor;
104 int mColorizeH = 0, mColorizeS = 50;
105 int mColorizeStrength = 100;
106};
107
108#endif // QGSHUESATURATIONFILTER_H
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:62
Color and saturation filter pipe for rasters.
void setColorizeOn(bool colorizeOn)
bool invertColors() const
Returns true if the filter inverts colors.
void setGrayscaleMode(QgsHueSaturationFilter::GrayscaleMode grayscaleMode)
QgsHueSaturationFilter(QgsRasterInterface *input=nullptr)
void setInvertColors(bool invertColors)
Sets whether the filter will invert colors.
QgsHueSaturationFilter::GrayscaleMode grayscaleMode() const
void setColorizeStrength(int colorizeStrength)
Feedback object tailored for raster block reading.
Raster data container.
Base class for processing filters like renderers, reprojector, resampler etc.
virtual QgsRasterInterface * clone() const =0
Clone itself, create deep copy.
QgsRasterInterface(QgsRasterInterface *input=nullptr)
virtual void readXml(const QDomElement &filterElem)
Sets base class members from xml. Usually called from create() methods of subclasses.
virtual void writeXml(QDomDocument &doc, QDomElement &parentElem) const
Write base class members to xml.
A rectangle specified with double values.
#define SIP_FACTORY
Definition qgis_sip.h:83