QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 "qgis_core.h"
22 #include "qgis_sip.h"
23 #include "qgsrasterinterface.h"
24 
25 class QDomElement;
26 
32 {
33  public:
35 
38 
40  int bandCount() const override;
41 
43  Qgis::DataType dataType( int bandNo ) const override;
44 
49  bool setInput( QgsRasterInterface *input ) override;
50 
61  QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
62 
67  void setBrightness( int brightness );
68 
73  int brightness() const { return mBrightness; }
74 
79  void setContrast( int contrast );
80 
85  int contrast() const { return mContrast; }
86 
93  void setGamma( double gamma );
94 
101  double gamma() const { return mGamma; }
102 
104  void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
105 
107  void readXml( const QDomElement &filterElem ) override;
108 
109  private:
111  int adjustColorComponent( int colorComponent, int alpha, int brightness, double contrastFactor, double gammaCorrection ) const;
112 
114  int mBrightness = 0;
115 
117  int mContrast = 0;
118 
120  double mGamma = 1.0;
121 
122 };
123 
124 #endif // QGSBRIGHTNESSCONTRASTFILTER_H
QgsRasterInterface::writeXml
virtual void writeXml(QDomDocument &doc, QDomElement &parentElem) const
Write base class members to xml.
Definition: qgsrasterinterface.h:494
Qgis::DataType
DataType
Raster data types.
Definition: qgis.h:128
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:41
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
qgsrasterinterface.h
QgsRasterInterface::setInput
virtual bool setInput(QgsRasterInterface *input)
Set input.
Definition: qgsrasterinterface.h:299
QgsBrightnessContrastFilter::brightness
int brightness() const
Returns current brightness level.
Definition: qgsbrightnesscontrastfilter.h:73
QgsRasterInterface::dataType
virtual Qgis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
qgis_sip.h
QgsRasterInterface::clone
virtual QgsRasterInterface * clone() const =0
Clone itself, create deep copy.
QgsRasterInterface::readXml
virtual void readXml(const QDomElement &filterElem)
Sets base class members from xml. Usually called from create() methods of subclasses.
Definition: qgsrasterinterface.h:496
QgsBrightnessContrastFilter::contrast
int contrast() const
Returns current contrast level.
Definition: qgsbrightnesscontrastfilter.h:85
QgsRasterInterface
Base class for processing filters like renderers, reprojector, resampler etc.
Definition: qgsrasterinterface.h:135
QgsBrightnessContrastFilter
Brightness/contrast and gamma correction filter pipe for rasters.
Definition: qgsbrightnesscontrastfilter.h:31
QgsRasterBlockFeedback
Feedback object tailored for raster block reading.
Definition: qgsrasterinterface.h:41
QgsRasterInterface::bandCount
virtual int bandCount() const =0
Gets number of bands.
QgsRasterInterface::block
virtual QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr)=0
Read block of data using given extent and size.
QgsBrightnessContrastFilter::gamma
double gamma() const
Returns current gamma value.
Definition: qgsbrightnesscontrastfilter.h:101
QgsRasterBlock
Raster data container.
Definition: qgsrasterblock.h:36