|
Quantum GIS API Documentation
master-693a1fe
|
00001 /*************************************************************************** 00002 qgsbrightnesscontrastfilter.h 00003 ------------------- 00004 begin : February 2013 00005 copyright : (C) 2013 by Alexander Bruy 00006 email : alexander dot bruy at gmail dot com 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef QGSBRIGHTNESSCONTRASTFILTER_H 00019 #define QGSBRIGHTNESSCONTRASTFILTER_H 00020 00021 #include "qgsrasterdataprovider.h" 00022 #include "qgsrasterinterface.h" 00023 00024 class QDomElement; 00025 00029 class CORE_EXPORT QgsBrightnessContrastFilter : public QgsRasterInterface 00030 { 00031 public: 00032 QgsBrightnessContrastFilter( QgsRasterInterface *input = 0 ); 00033 ~QgsBrightnessContrastFilter(); 00034 00035 QgsRasterInterface * clone() const; 00036 00037 int bandCount() const; 00038 00039 QGis::DataType dataType( int bandNo ) const; 00040 00041 bool setInput( QgsRasterInterface* input ); 00042 00043 QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height ); 00044 00045 void setBrightness( int brightness ) { mBrightness = qBound( -255, brightness, 255 ); } 00046 int brightness() const { return mBrightness; } 00047 00048 void setContrast( int contrast ) { mContrast = qBound( -100, contrast, 100 ); } 00049 int contrast() const { return mContrast; } 00050 00051 void writeXML( QDomDocument& doc, QDomElement& parentElem ) const; 00052 00054 void readXML( const QDomElement& filterElem ); 00055 00056 private: 00058 int adjustColorComponent( int colorComponent, int alpha, int brightness, double contrastFactor ) const; 00059 00061 int mBrightness; 00062 00064 double mContrast; 00065 }; 00066 00067 #endif // QGSBRIGHTNESSCONTRASTFILTER_H