QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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  */
50 
56  double maximumValue() const { return mMaximumValue; }
57 
63  double minimumValue() const { return mMinimumValue; }
64 
65  QgsRasterShaderFunction *rasterShaderFunction() { return mRasterShaderFunction.get(); }
66  const QgsRasterShaderFunction *rasterShaderFunction() const { return mRasterShaderFunction.get(); } SIP_SKIP
67 
68  /*
69  *
70  * Non-Static methods
71  *
72  */
73 
84  bool shade( double value,
85  int *returnRedValue SIP_OUT,
86  int *returnGreenValue SIP_OUT,
87  int *returnBlueValue SIP_OUT,
88  int *returnAlpha SIP_OUT );
89 
102  bool shade( double redValue,
103  double greenValue,
104  double blueValue,
105  double alphaValue,
106  int *returnRedValue SIP_OUT,
107  int *returnGreenValue SIP_OUT,
108  int *returnBlueValue SIP_OUT,
109  int *returnAlpha SIP_OUT );
110 
115  void setRasterShaderFunction( QgsRasterShaderFunction *function SIP_TRANSFER );
116 
122  void setMaximumValue( double value );
123 
129  void setMinimumValue( double value );
130 
134  void writeXml( QDomDocument &doc, QDomElement &parent ) const;
135 
139  void readXml( const QDomElement &elem );
140 
141  private:
142 #ifdef SIP_RUN
143  QgsRasterShader( const QgsRasterShader &rh );
144 #endif
145 
147  double mMinimumValue;
148 
150  double mMaximumValue;
151 
153  std::unique_ptr< QgsRasterShaderFunction > mRasterShaderFunction;
154 
155 };
156 #endif
Interface for all raster shaders.
double minimumValue() const
Returns the minimum value for the raster shader.
const QgsRasterShaderFunction * rasterShaderFunction() const
#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() const
Returns the maximum value for the raster shader.
#define SIP_OUT
Definition: qgis_sip.h:51