Class: QgsRasterShader¶
Interface for all raster shaders.
Methods
Returns the maximum value for the raster shader. |
|
Returns the minimum value for the raster shader. |
|
Reads shader state from an XML element. |
|
Sets the maximum value for the raster shader. |
|
Sets the minimum value for the raster shader. |
|
A public method that allows the user to set their own shader function. |
|
Generates a new RGBA value based on one input value. |
|
Writes shader state to an XML element. |
- class qgis.core.QgsRasterShader[source]¶
Bases:
object
- maximumValue(self) float [source]¶
Returns the maximum value for the raster shader.
See also
See also
- Return type:
float
- minimumValue(self) float [source]¶
Returns the minimum value for the raster shader.
See also
See also
- Return type:
float
- rasterShaderFunction(self) QgsRasterShaderFunction | None [source]¶
- Return type:
Optional[QgsRasterShaderFunction]
- readXml(self, elem: QDomElement, context: QgsReadWriteContext = QgsReadWriteContext())[source]¶
Reads shader state from an XML element.
- Parameters:
elem (QDomElement)
context (
QgsReadWriteContext
= QgsReadWriteContext())
- setMaximumValue(self, value: float)[source]¶
Sets the maximum
value
for the raster shader.See also
See also
- Parameters:
value (float)
- setMinimumValue(self, value: float)[source]¶
Sets the minimum
value
for the raster shader.See also
See also
- Parameters:
value (float)
- setRasterShaderFunction(self, function: QgsRasterShaderFunction | None)[source]¶
A public method that allows the user to set their own shader
function
.Note
Raster shader takes ownership of the shader function instance
- Parameters:
function (Optional[QgsRasterShaderFunction])
- shade(self, value: float)[source]¶
Generates a new RGBA value based on one input
value
.- Parameters:
value (float) -> (bool) – The original value to base a new RGBA value on
- Returns:
True
if the return values are valid otherwiseFalse
returnRedValue: The red component of the new RGBA value
returnGreenValue: The green component of the new RGBA value
returnBlueValue: The blue component of the new RGBA value
returnAlpha: The alpha component of the new RGBA value
- shade(self, redValue: float, greenValue: float, blueValue: float, alphaValue: float)[source]
Generates a new RGBA value based on an original RGBA value.
- Parameters:
redValue (float) – The red component of the original value to base a new RGBA value on
greenValue (float) – The green component of the original value to base a new RGBA value on
blueValue (float) – The blue component of the original value to base a new RGBA value on
alphaValue (float) -> (bool) – The alpha component of the original value to base a new RGBA value on
- Returns:
True
if the return values are valid otherwiseFalse
returnRedValue: The red component of the new RGBA value
returnGreenValue: The green component of the new RGBA value
returnBlueValue: The blue component of the new RGBA value
returnAlpha: The alpha component of the new RGBA value
- writeXml(self, doc: QDomDocument, parent: QDomElement, context: QgsReadWriteContext = QgsReadWriteContext())[source]¶
Writes shader state to an XML element.
- Parameters:
doc (QDomDocument)
parent (QDomElement)
context (
QgsReadWriteContext
= QgsReadWriteContext())