QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsbrightnesscontrastfilter.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsbrightnesscontrastfilter.h
3  -------------------
4  begin : February 2013
5  copyright : (C) 2013 by Alexander Bruy
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 QGSBRIGHTNESSCONTRASTFILTER_H
19 #define QGSBRIGHTNESSCONTRASTFILTER_H
20 
21 #include "qgsrasterdataprovider.h"
22 #include "qgsrasterinterface.h"
23 
24 class QDomElement;
25 
30 {
31  public:
34 
35  QgsRasterInterface * clone() const;
36 
37  int bandCount() const;
38 
39  QGis::DataType dataType( int bandNo ) const;
40 
41  bool setInput( QgsRasterInterface* input );
42 
43  QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height );
44 
45  void setBrightness( int brightness ) { mBrightness = qBound( -255, brightness, 255 ); }
46  int brightness() const { return mBrightness; }
47 
48  void setContrast( int contrast ) { mContrast = qBound( -100, contrast, 100 ); }
49  int contrast() const { return mContrast; }
50 
51  void writeXML( QDomDocument& doc, QDomElement& parentElem ) const;
52 
54  void readXML( const QDomElement& filterElem );
55 
56  private:
58  int adjustColorComponent( int colorComponent, int alpha, int brightness, double contrastFactor ) const;
59 
62 
64  double mContrast;
65 };
66 
67 #endif // QGSBRIGHTNESSCONTRASTFILTER_H