QGIS API Documentation  2.99.0-Master (19b062c)
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 
34 class CORE_EXPORT QgsRasterShader
35 {
36 
37  public:
38  QgsRasterShader( double minimumValue = 0.0, double maximumValue = 255.0 );
39 
41  QgsRasterShader( const QgsRasterShader &rh ) = delete;
43  QgsRasterShader &operator=( const QgsRasterShader &rh ) = delete;
44 
45  /*
46  *
47  * Non-Static Inline methods
48  *
49  */
51  double maximumValue() { return mMaximumValue; }
52 
54  double minimumValue() { return mMinimumValue; }
55 
56  QgsRasterShaderFunction *rasterShaderFunction() { return mRasterShaderFunction.get(); }
57  const QgsRasterShaderFunction *rasterShaderFunction() const { return mRasterShaderFunction.get(); } SIP_SKIP
58 
59  /*
60  *
61  * Non-Static methods
62  *
63  */
65  bool shade( double value,
66  int *returnRedValue SIP_OUT,
67  int *returnGreenValue SIP_OUT,
68  int *returnBlueValue SIP_OUT,
69  int *returnAlpha SIP_OUT );
70 
72  bool shade( double redValue,
73  double greenValue,
74  double blueValue,
75  double alphaValue,
76  int *returnRedValue SIP_OUT,
77  int *returnGreenValue SIP_OUT,
78  int *returnBlueValue SIP_OUT,
79  int *returnAlpha SIP_OUT );
80 
84  void setRasterShaderFunction( QgsRasterShaderFunction *function SIP_TRANSFER );
85 
87  void setMaximumValue( double );
88 
90  void setMinimumValue( double );
91 
95  void writeXml( QDomDocument &doc, QDomElement &parent ) const;
96 
100  void readXml( const QDomElement &elem );
101 
102  private:
103 #ifdef SIP_RUN
104  QgsRasterShader( const QgsRasterShader &rh );
105 #endif
106 
108  double mMinimumValue;
109 
111  double mMaximumValue;
112 
114  std::unique_ptr< QgsRasterShaderFunction > mRasterShaderFunction;
115 
116 };
117 #endif
Interface for all raster shaders.
#define SIP_SKIP
Definition: qgis_sip.h:119
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:36
double maximumValue()
Return the maximum value for the raster shader.
const QgsRasterShaderFunction * rasterShaderFunction() const
#define SIP_OUT
Definition: qgis_sip.h:51
double minimumValue()
Return the minimum value for the raster shader.