QGIS API Documentation  2.3.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 "qgsrasterdataprovider.h"
22 #include "qgsrasterinterface.h"
23 
24 class QDomElement;
25 
29 class CORE_EXPORT QgsHueSaturationFilter : public QgsRasterInterface
30 {
31  public:
32 
33  // Available modes for converting a raster to grayscale
35  {
39  GrayscaleAverage
40  };
41 
44 
45  QgsRasterInterface * clone() const;
46 
47  int bandCount() const;
48 
49  QGis::DataType dataType( int bandNo ) const;
50 
51  bool setInput( QgsRasterInterface* input );
52 
53  QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height );
54 
55  void setSaturation( int saturation );
56  int saturation() const { return mSaturation; }
57 
58  void setGrayscaleMode( QgsHueSaturationFilter::GrayscaleMode grayscaleMode ) { mGrayscaleMode = grayscaleMode; }
59  QgsHueSaturationFilter::GrayscaleMode grayscaleMode() const { return mGrayscaleMode; }
60 
61  void setColorizeOn( bool colorizeOn ) { mColorizeOn = colorizeOn; }
62  bool colorizeOn() const { return mColorizeOn; }
63  void setColorizeColor( QColor colorizeColor );
64  QColor colorizeColor() const { return mColorizeColor; }
65  void setColorizeStrength( int colorizeStrength ) { mColorizeStrength = colorizeStrength; }
66  int colorizeStrength() const { return mColorizeStrength; }
67 
68  void writeXML( QDomDocument& doc, QDomElement& parentElem ) const;
69 
71  void readXML( const QDomElement& filterElem );
72 
73  private:
75  void processSaturation( int &r, int &g, int &b, int &h, int &s, int &l );
77  void processColorization( int &r, int &g, int &b, int &h, int &s, int &l ) ;
78 
82 
85 
89  int mColorizeH, mColorizeS;
91 
92 };
93 
94 #endif // QGSHUESATURATIONFILTER_H
virtual int bandCount() const =0
Get number of bands.
A rectangle specified with double values.
Definition: qgsrectangle.h:35
QgsHueSaturationFilter::GrayscaleMode mGrayscaleMode
Current grayscale mode.
virtual void readXML(const QDomElement &filterElem)
Sets base class members from xml.
Raster data container.
QgsHueSaturationFilter::GrayscaleMode grayscaleMode() const
virtual void writeXML(QDomDocument &doc, QDomElement &parentElem) const
Write base class members to xml.
int mSaturation
Current saturation value.
virtual QGis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
void setColorizeOn(bool colorizeOn)
Base class for processing filters like renderers, reprojector, resampler etc.
virtual bool setInput(QgsRasterInterface *input)
Set input.
virtual QgsRasterInterface * clone() const =0
Clone itself, create deep copy.
Color and saturation filter pipe for rasters.
DataType
Raster data types.
Definition: qgis.h:204
virtual QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height)=0
Read block of data using given extent and size.
bool mColorizeOn
Colorize settings.
void setColorizeStrength(int colorizeStrength)
void setGrayscaleMode(QgsHueSaturationFilter::GrayscaleMode grayscaleMode)