QgsRasterTransparency class

Defines the list of pixel values to be considered as transparent or semi transparent when rendering rasters.

Constructors, destructors, conversion operators

QgsRasterTransparency() defaulted
Constructor for QgsRasterTransparency.

Public functions

auto alphaValue(double value, int globalTransparency = 255) const -> int
Returns the transparency value for a single value pixel.
auto alphaValue(double redValue, double greenValue, double blueValue, int globalTransparency = 255) const -> int
Returns the transparency value for a RGB pixel.
void initializeTransparentPixelList(double value)
Resets the transparency list to a single value.
void initializeTransparentPixelList(double redValue, double greenValue, double blueValue)
Resets the transparency list to single red, green, and blue values.
auto isEmpty() const -> bool
True if there are no entries in the pixel lists except the nodata value.
void readXml(const QDomElement& elem)
Reads the transparency information from an XML document.
void setTransparentSingleValuePixelList(const QList<QgsRasterTransparency::TransparentSingleValuePixel>& newList)
Sets the transparent single value pixel list, replacing the whole existing list.
void setTransparentThreeValuePixelList(const QList<QgsRasterTransparency::TransparentThreeValuePixel>& newList)
Sets the transparent three value pixel list, replacing the whole existing list.
auto transparentSingleValuePixelList() const -> QList<QgsRasterTransparency::TransparentSingleValuePixel>
Returns the transparent single value pixel list.
auto transparentThreeValuePixelList() const -> QList<QgsRasterTransparency::TransparentThreeValuePixel>
Returns the transparent three value pixel list.
void writeXml(QDomDocument& doc, QDomElement& parentElem) const
Writes the transparency information to an XML document.

Function documentation

int QgsRasterTransparency::alphaValue(double value, int globalTransparency = 255) const

Returns the transparency value for a single value pixel.

Parameters
value the needle to search for in the transparency hay stack
globalTransparency the overall transparency level for the layer

Searches through the transparency list, and if a match is found, the global transparency value is scaled by the stored transparency value.

int QgsRasterTransparency::alphaValue(double redValue, double greenValue, double blueValue, int globalTransparency = 255) const

Returns the transparency value for a RGB pixel.

Parameters
redValue the red portion of the needle to search for in the transparency hay stack
greenValue the green portion of the needle to search for in the transparency hay stack
blueValue the green portion of the needle to search for in the transparency hay stack
globalTransparency the overal transparency level for the layer

Searches through the transparency list, if a match is found, the global transparency value is scaled by the stored transparency value.

void QgsRasterTransparency::setTransparentSingleValuePixelList(const QList<QgsRasterTransparency::TransparentSingleValuePixel>& newList)

Sets the transparent single value pixel list, replacing the whole existing list.

void QgsRasterTransparency::setTransparentThreeValuePixelList(const QList<QgsRasterTransparency::TransparentThreeValuePixel>& newList)

Sets the transparent three value pixel list, replacing the whole existing list.

QList<QgsRasterTransparency::TransparentSingleValuePixel> QgsRasterTransparency::transparentSingleValuePixelList() const

Returns the transparent single value pixel list.

QList<QgsRasterTransparency::TransparentThreeValuePixel> QgsRasterTransparency::transparentThreeValuePixelList() const

Returns the transparent three value pixel list.