Class: QgsRasterShaderFunction

The raster shade function applies a shader to a pixel at render time - typically used to render grayscale images as false color.

Class Hierarchy

Inheritance diagram of qgis.core.QgsRasterShaderFunction

Subclasses

QgsColorRampShader

A ramp shader will color a raster pixel based on a list of values ranges in a ramp.

class qgis.core.QgsRasterShaderFunction[source]

Bases: object

labelPrecision(self) int[source]

Returns label precision

Added in version 3.16.

Return type:

int

virtual legendSymbologyItems(self) List[Tuple[str, QColor]][source]

Returns legend symbology items if provided by renderer.

Return type:

List[Tuple[str, QColor]]

maximumValue(self) float[source]

Returns the minimum value for the raster shader.

See also

maximumValue()

Return type:

float

minimumMaximumRange(self) float[source]
Return type:

float

minimumValue(self) float[source]

Returns the maximum value for the raster shader.

See also

minimumValue()

Return type:

float

setLabelPrecision(self, labelPrecision: int)[source]

Sets label precision to labelPrecision

Added in version 3.16.

Parameters:

labelPrecision (int)

virtual setMaximumValue(self, value: float)[source]

Sets the maximum value for the raster shader.

See also

maximumValue()

Parameters:

value (float)

virtual setMinimumValue(self, value: float)[source]

Sets the minimum value for the raster shader.

See also

minimumValue()

Parameters:

value (float)

virtual shade(self, value: float)[source]

Generates an 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 otherwise False

  • 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) -> (bool, Optional[int], Optional[int], Optional[int], Optional[int]) Generates an new RGBA value based on an original RGBA value.

Parameters:
  • redValue – The red component of the original value to base a new RGBA value on

  • greenValue – The green component of the original value to base a new RGBA value on

  • blueValue – The blue component of the original value to base a new RGBA value on

  • alphaValue – The alpha component of the original value to base a new RGBA value on

Returns:

  • True if the return values are valid otherwise False

  • 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