QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
qgsrastershader.h
Go to the documentation of this file.
1/* **************************************************************************
2 qgsrastershader.h - description
3 -------------------
4begin : Fri Dec 28 2007
5copyright : (C) 2007 by Peter J. Ersts
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#include "qgsreadwritecontext.h"
26
27class QDomDocument;
28class QDomElement;
30
35class CORE_EXPORT QgsRasterShader
36{
37
38 public:
39 QgsRasterShader( double minimumValue = 0.0, double maximumValue = 255.0 );
40
42 QgsRasterShader( const QgsRasterShader &rh ) = delete;
45
46 /*
47 *
48 * Non-Static Inline methods
49 *
50 */
51
57 double maximumValue() const { return mMaximumValue; }
58
64 double minimumValue() const { return mMinimumValue; }
65
66 QgsRasterShaderFunction *rasterShaderFunction() { return mRasterShaderFunction.get(); }
67 const QgsRasterShaderFunction *rasterShaderFunction() const { return mRasterShaderFunction.get(); } SIP_SKIP
68
69 /*
70 *
71 * Non-Static methods
72 *
73 */
74
85 bool shade( double value,
86 int *returnRedValue SIP_OUT,
87 int *returnGreenValue SIP_OUT,
88 int *returnBlueValue SIP_OUT,
89 int *returnAlpha SIP_OUT );
90
103 bool shade( double redValue,
104 double greenValue,
105 double blueValue,
106 double alphaValue,
107 int *returnRedValue SIP_OUT,
108 int *returnGreenValue SIP_OUT,
109 int *returnBlueValue SIP_OUT,
110 int *returnAlpha SIP_OUT );
111
116 void setRasterShaderFunction( QgsRasterShaderFunction *function SIP_TRANSFER );
117
123 void setMaximumValue( double value );
124
130 void setMinimumValue( double value );
131
135 void writeXml( QDomDocument &doc, QDomElement &parent, const QgsReadWriteContext &context = QgsReadWriteContext() ) const;
136
140 void readXml( const QDomElement &elem, const QgsReadWriteContext &context = QgsReadWriteContext() );
141
142 private:
143#ifdef SIP_RUN
144 QgsRasterShader( const QgsRasterShader &rh );
145#endif
146
148 double mMinimumValue;
149
151 double mMaximumValue;
152
154 std::unique_ptr< QgsRasterShaderFunction > mRasterShaderFunction;
155
156};
157#endif
The raster shade function applies a shader to a pixel at render time - typically used to render grays...
Interface for all raster shaders.
double maximumValue() const
Returns the maximum value for the raster shader.
QgsRasterShader & operator=(const QgsRasterShader &rh)=delete
QgsRasterShader cannot be copied.
QgsRasterShader(const QgsRasterShader &rh)=delete
QgsRasterShader cannot be copied.
const QgsRasterShaderFunction * rasterShaderFunction() const
double minimumValue() const
Returns the minimum value for the raster shader.
QgsRasterShaderFunction * rasterShaderFunction()
The class is used as a container of context for various read/write operations on other objects.
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_OUT
Definition: qgis_sip.h:58