QGIS API Documentation  2.99.0-Master (69af2f5)
qgsrastershader.h
Go to the documentation of this file.
1 /* **************************************************************************
2  qgsrastershader.h - description
3  -------------------
4 begin : Fri Dec 28 2007
5 copyright : (C) 2007 by Peter J. Ersts
6 email : [email protected]
7 
8 ****************************************************************************/
9 
10 /* **************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 
20 #ifndef QGSRASTERSHADER_H
21 #define QGSRASTERSHADER_H
22 
23 #include "qgis_core.h"
24 #include "qgis_sip.h"
25 
26 class QDomDocument;
27 class QDomElement;
29 
33 class CORE_EXPORT QgsRasterShader
34 {
35 
36  public:
37  QgsRasterShader( double minimumValue = 0.0, double maximumValue = 255.0 );
38 
40  QgsRasterShader( const QgsRasterShader &rh ) = delete;
42  QgsRasterShader &operator=( const QgsRasterShader &rh ) = delete;
43 
44  /*
45  *
46  * Non-Static Inline methods
47  *
48  */
50  double maximumValue() { return mMaximumValue; }
51 
53  double minimumValue() { return mMinimumValue; }
54 
55  QgsRasterShaderFunction *rasterShaderFunction() { return mRasterShaderFunction.get(); }
56  const QgsRasterShaderFunction *rasterShaderFunction() const { return mRasterShaderFunction.get(); } SIP_SKIP
57 
58  /*
59  *
60  * Non-Static methods
61  *
62  */
64  bool shade( double value,
65  int *returnRedValue SIP_OUT,
66  int *returnGreenValue SIP_OUT,
67  int *returnBlueValue SIP_OUT,
68  int *returnAlpha SIP_OUT );
69 
71  bool shade( double redValue,
72  double greenValue,
73  double blueValue,
74  double alphaValue,
75  int *returnRedValue SIP_OUT,
76  int *returnGreenValue SIP_OUT,
77  int *returnBlueValue SIP_OUT,
78  int *returnAlpha SIP_OUT );
79 
82  void setRasterShaderFunction( QgsRasterShaderFunction *function SIP_TRANSFER );
83 
85  void setMaximumValue( double );
86 
88  void setMinimumValue( double );
89 
93  void writeXml( QDomDocument &doc, QDomElement &parent ) const;
94 
98  void readXml( const QDomElement &elem );
99 
100  private:
101 #ifdef SIP_RUN
102  QgsRasterShader( const QgsRasterShader &rh );
103 #endif
104 
106  double mMinimumValue;
107 
109  double mMaximumValue;
110 
112  std::unique_ptr< QgsRasterShaderFunction > mRasterShaderFunction;
113 
114 };
115 #endif
Interface for all raster shaders.
#define SIP_SKIP
Definition: qgis_sip.h:107
QgsRasterShaderFunction * rasterShaderFunction()
The raster shade function applies a shader to a pixel at render time - typically used to render grays...
#define SIP_TRANSFER
Definition: qgis_sip.h:24
double maximumValue()
Return the maximum value for the raster shader.
const QgsRasterShaderFunction * rasterShaderFunction() const
#define SIP_OUT
Definition: qgis_sip.h:39
double minimumValue()
Return the minimum value for the raster shader.