QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
|
Defines the list of pixel values to be considered as transparent or semi transparent when rendering rasters. More...
#include <qgsrastertransparency.h>
Classes | |
struct | TransparentSingleValuePixel |
Defines the transparency for a range of single-band pixel values. More... | |
struct | TransparentThreeValuePixel |
Defines the transparency for a RGB pixel value. More... | |
Public Member Functions | |
QgsRasterTransparency ()=default | |
Q_DECL_DEPRECATED int | alphaValue (double redValue, double greenValue, double blueValue, int globalTransparency=255) const |
Returns the transparency value for a RGB pixel. | |
Q_DECL_DEPRECATED int | alphaValue (double value, int globalTransparency=255) const |
Returns the transparency value for a single value pixel. | |
void | initializeTransparentPixelList (double redValue, double greenValue, double blueValue) |
Resets the transparency list to single red, green, and blue values. | |
void | initializeTransparentPixelList (double value) |
Resets the transparency list to a single value. | |
bool | isEmpty () const |
True if there are no entries in the pixel lists except the nodata value. | |
double | opacityForRgbValues (double redValue, double greenValue, double blueValue) const |
Returns the opacity (as a value from 0 to 1) for a set of RGB pixel values. | |
double | opacityForValue (double value) const |
Returns the opacity (as a value from 0 to 1) for a single value pixel. | |
void | readXml (const QDomElement &elem) |
Reads the transparency information from an XML document. | |
void | setTransparentSingleValuePixelList (const QVector< QgsRasterTransparency::TransparentSingleValuePixel > &newList) |
Sets the transparent single value pixel list, replacing the whole existing list. | |
void | setTransparentThreeValuePixelList (const QVector< QgsRasterTransparency::TransparentThreeValuePixel > &newList) |
Sets the transparent three value pixel list, replacing the whole existing list. | |
QVector< QgsRasterTransparency::TransparentSingleValuePixel > | transparentSingleValuePixelList () const |
Returns the transparent single value pixel list. | |
QVector< QgsRasterTransparency::TransparentThreeValuePixel > | transparentThreeValuePixelList () const |
Returns the transparent three value pixel list. | |
void | writeXml (QDomDocument &doc, QDomElement &parentElem) const |
Writes the transparency information to an XML document. | |
Defines the list of pixel values to be considered as transparent or semi transparent when rendering rasters.
Definition at line 33 of file qgsrastertransparency.h.
|
default |
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.
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 overall transparency level for the layer |
Definition at line 93 of file qgsrastertransparency.cpp.
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.
value | the needle to search for in the transparency hay stack |
globalTransparency | the overall transparency level for the layer |
Definition at line 64 of file qgsrastertransparency.cpp.
void QgsRasterTransparency::initializeTransparentPixelList | ( | double | redValue, |
double | greenValue, | ||
double | blueValue | ||
) |
Resets the transparency list to single red, green, and blue values.
Definition at line 45 of file qgsrastertransparency.cpp.
void QgsRasterTransparency::initializeTransparentPixelList | ( | double | value | ) |
Resets the transparency list to a single value.
Definition at line 36 of file qgsrastertransparency.cpp.
bool QgsRasterTransparency::isEmpty | ( | ) | const |
True if there are no entries in the pixel lists except the nodata value.
Definition at line 122 of file qgsrastertransparency.cpp.
double QgsRasterTransparency::opacityForRgbValues | ( | double | redValue, |
double | greenValue, | ||
double | blueValue | ||
) | const |
Returns the opacity (as a value from 0 to 1) for a set of RGB pixel values.
Searches through the transparency list, and if a match is found, returns the opacity corresponding to the values. Returns 1 if no matches are found.
If any of the red, green or blue values are NaN, 0 will be returned.
Definition at line 98 of file qgsrastertransparency.cpp.
double QgsRasterTransparency::opacityForValue | ( | double | value | ) | const |
Returns the opacity (as a value from 0 to 1) for a single value pixel.
Searches through the transparency list, and if a match is found, returns the opacity corresponding to the value. Returns 1 if no matches are found.
Definition at line 69 of file qgsrastertransparency.cpp.
void QgsRasterTransparency::readXml | ( | const QDomElement & | elem | ) |
Reads the transparency information from an XML document.
Definition at line 169 of file qgsrastertransparency.cpp.
void QgsRasterTransparency::setTransparentSingleValuePixelList | ( | const QVector< QgsRasterTransparency::TransparentSingleValuePixel > & | newList | ) |
Sets the transparent single value pixel list, replacing the whole existing list.
Definition at line 54 of file qgsrastertransparency.cpp.
void QgsRasterTransparency::setTransparentThreeValuePixelList | ( | const QVector< QgsRasterTransparency::TransparentThreeValuePixel > & | newList | ) |
Sets the transparent three value pixel list, replacing the whole existing list.
Definition at line 59 of file qgsrastertransparency.cpp.
QVector< QgsRasterTransparency::TransparentSingleValuePixel > QgsRasterTransparency::transparentSingleValuePixelList | ( | ) | const |
Returns the transparent single value pixel list.
Definition at line 26 of file qgsrastertransparency.cpp.
QVector< QgsRasterTransparency::TransparentThreeValuePixel > QgsRasterTransparency::transparentThreeValuePixelList | ( | ) | const |
Returns the transparent three value pixel list.
Definition at line 31 of file qgsrastertransparency.cpp.
void QgsRasterTransparency::writeXml | ( | QDomDocument & | doc, |
QDomElement & | parentElem | ||
) | const |
Writes the transparency information to an XML document.
Definition at line 127 of file qgsrastertransparency.cpp.