QGIS API Documentation 3.41.0-Master (45a0abf3bec)
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
35 // Available modes for converting a raster to grayscale
43
45
47
48 int bandCount() const override;
49
50 Qgis::DataType dataType( int bandNo ) const override;
51
52 bool setInput( QgsRasterInterface *input ) override;
53
54 QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
55
56 void setSaturation( int saturation );
57 int saturation() const { return mSaturation; }
58
64 void setInvertColors( bool invertColors ) { mInvertColors = invertColors; }
65
70 bool invertColors() const { return mInvertColors; }
71
72 void setGrayscaleMode( QgsHueSaturationFilter::GrayscaleMode grayscaleMode ) { mGrayscaleMode = grayscaleMode; }
73 QgsHueSaturationFilter::GrayscaleMode grayscaleMode() const { return mGrayscaleMode; }
74
75 void setColorizeOn( bool colorizeOn ) { mColorizeOn = colorizeOn; }
76 bool colorizeOn() const { return mColorizeOn; }
77 void setColorizeColor( const QColor &colorizeColor );
78 QColor colorizeColor() const { return mColorizeColor; }
79 void setColorizeStrength( int colorizeStrength ) { mColorizeStrength = colorizeStrength; }
80 int colorizeStrength() const { return mColorizeStrength; }
81
82 void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
83
85 void readXml( const QDomElement &filterElem ) override;
86
87 private:
89 void processSaturation( int &r, int &g, int &b, int &h, int &s, int &l );
91 void processColorization( int &r, int &g, int &b, int &h, int &s, int &l ) const;
92
94 int mSaturation = 0;
95 double mSaturationScale = 1;
96
99
100 bool mInvertColors = false;
101
103 bool mColorizeOn = false;
104 QColor mColorizeColor;
105 int mColorizeH = 0, mColorizeS = 50;
106 int mColorizeStrength = 100;
107
108};
109
110#endif // QGSHUESATURATIONFILTER_H
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
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)
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.
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:76