Class: QgsRasterShaderFunction

class qgis.core.QgsRasterShaderFunction

Bases: sip.wrapper

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

Methods

labelPrecision

Returns label precision

legendSymbologyItems

Returns legend symbology items if provided by renderer.

maximumValue

Returns the minimum value for the raster shader.

minimumMaximumRange

rtype:

float

minimumValue

Returns the maximum value for the raster shader.

setLabelPrecision

Sets label precision to labelPrecision

setMaximumValue

Sets the maximum value for the raster shader.

setMinimumValue

Sets the minimum value for the raster shader.

shade

Generates an new RGBA value based on one input value.

labelPrecision(self) int

Returns label precision

New in version 3.16.

Return type:

int

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

Returns legend symbology items if provided by renderer.

Return type:

List[Tuple[str, QColor]]

maximumValue(self) float

Returns the minimum value for the raster shader.

See also

maximumValue()

Return type:

float

minimumMaximumRange(self) float
Return type:

float

minimumValue(self) float

Returns the maximum value for the raster shader.

See also

minimumValue()

Return type:

float

setLabelPrecision(self, labelPrecision: int)

Sets label precision to labelPrecision

New in version 3.16.

Parameters:

labelPrecision (int) –

setMaximumValue(self, value: float)

Sets the maximum value for the raster shader.

See also

maximumValue()

Parameters:

value (float) –

setMinimumValue(self, value: float)

Sets the minimum value for the raster shader.

See also

minimumValue()

Parameters:

value (float) –

shade(self, value: float) Tuple[bool, int, int, int, int]

Generates an new RGBA value based on one input value.

Parameters:
  • value (float) – The original value to base a new RGBA value on

  • 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

Returns:

  • True if the return values are valid otherwise False

  • returnAlpha: The alpha component of the new RGBA value

shade(self, redValue: float, greenValue: float, blueValue: float, alphaValue: float) -> Tuple[bool, int, int, int, 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

  • 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

Return type:

Tuple[bool, int, int, int, int]

Returns:

  • True if the return values are valid otherwise False

  • returnAlpha: The alpha component of the new RGBA value