QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
Classes | Public Member Functions | List of all members
QgsRasterTransparency Class Reference

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

#include <qgsrastertransparency.h>

Classes

struct  TransparentSingleValuePixel
 
struct  TransparentThreeValuePixel
 

Public Member Functions

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

Detailed Description

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

Definition at line 32 of file qgsrastertransparency.h.

Constructor & Destructor Documentation

◆ QgsRasterTransparency()

QgsRasterTransparency::QgsRasterTransparency ( )
default

Constructor for QgsRasterTransparency.

Member Function Documentation

◆ alphaValue() [1/2]

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

Returns the transparency value for a RGB pixel.

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

Parameters
redValuethe red portion of the needle to search for in the transparency hay stack
greenValuethe green portion of the needle to search for in the transparency hay stack
blueValuethe green portion of the needle to search for in the transparency hay stack
globalTransparencythe overall transparency level for the layer

Definition at line 106 of file qgsrastertransparency.cpp.

◆ alphaValue() [2/2]

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

Returns the transparency value for a single value pixel.

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

Parameters
valuethe needle to search for in the transparency hay stack
globalTransparencythe overall transparency level for the layer

Definition at line 74 of file qgsrastertransparency.cpp.

◆ initializeTransparentPixelList() [1/2]

void QgsRasterTransparency::initializeTransparentPixelList ( double  redValue,
double  greenValue,
double  blueValue 
)

Resets the transparency list to single red, green, and blue values.

Definition at line 50 of file qgsrastertransparency.cpp.

◆ initializeTransparentPixelList() [2/2]

void QgsRasterTransparency::initializeTransparentPixelList ( double  value)

Resets the transparency list to a single value.

Definition at line 37 of file qgsrastertransparency.cpp.

◆ isEmpty()

bool QgsRasterTransparency::isEmpty ( ) const

True if there are no entries in the pixel lists except the nodata value.

Definition at line 142 of file qgsrastertransparency.cpp.

◆ readXml()

void QgsRasterTransparency::readXml ( const QDomElement &  elem)

Reads the transparency information from an XML document.

Definition at line 183 of file qgsrastertransparency.cpp.

◆ setTransparentSingleValuePixelList()

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

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

See also
transparentSingleValuePixelList()

Definition at line 64 of file qgsrastertransparency.cpp.

◆ setTransparentThreeValuePixelList()

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

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

See also
transparentThreeValuePixelList()

Definition at line 69 of file qgsrastertransparency.cpp.

◆ transparentSingleValuePixelList()

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

Returns the transparent single value pixel list.

See also
setTransparentSingleValuePixelList()

Definition at line 27 of file qgsrastertransparency.cpp.

◆ transparentThreeValuePixelList()

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

Returns the transparent three value pixel list.

See also
setTransparentThreeValuePixelList()

Definition at line 32 of file qgsrastertransparency.cpp.

◆ writeXml()

void QgsRasterTransparency::writeXml ( QDomDocument &  doc,
QDomElement &  parentElem 
) const

Writes the transparency information to an XML document.

Definition at line 147 of file qgsrastertransparency.cpp.


The documentation for this class was generated from the following files: