QGIS API Documentation  2.6.0-Brighton
 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 
80  int mSaturation;
81  double mSaturationScale;
82 
85 
87  bool mColorizeOn;
88  QColor mColorizeColor;
89  int mColorizeH, mColorizeS;
90  int mColorizeStrength;
91 
92 };
93 
94 #endif // QGSHUESATURATIONFILTER_H