Class: QgsRasterTransparency¶
-
class
qgis.core.
QgsRasterTransparency
¶ Bases:
sip.wrapper
Constructor for QgsRasterTransparency.
QgsRasterTransparency(
QgsRasterTransparency
)Defines the list of pixel values to be considered as transparent or semi transparent when rendering rasters.
Methods
Returns the transparency value for a single
value
pixel.Resets the transparency list to a single
value
.True if there are no entries in the pixel lists except the nodata value
Reads the transparency information from an XML document.
Sets the transparent single value pixel list, replacing the whole existing list.
Sets the transparent three value pixel list, replacing the whole existing list.
Returns the transparent single value pixel list.
Returns the transparent three value pixel list.
Writes the transparency information to an XML document.
-
class
TransparentSingleValuePixel
¶ Bases:
sip.wrapper
QgsRasterTransparency.TransparentSingleValuePixel(QgsRasterTransparency.TransparentSingleValuePixel)
-
max
¶
-
min
¶
-
percentTransparent
¶
-
-
class
TransparentThreeValuePixel
¶ Bases:
sip.wrapper
QgsRasterTransparency.TransparentThreeValuePixel(QgsRasterTransparency.TransparentThreeValuePixel)
-
blue
¶
-
green
¶
-
percentTransparent
¶
-
red
¶
-
-
alphaValue
(self, value: float, globalTransparency: int = 255) → int¶ 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
value (float) – the needle to search for in the transparency hay stack
globalTransparency (int = 255) – the overall transparency level for the layer
alphaValue(self, redValue: float, greenValue: float, blueValue: float, globalTransparency: int = 255) -> int 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
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
- Return type
int
-
initializeTransparentPixelList
(self, value: float)¶ Resets the transparency list to a single
value
.initializeTransparentPixelList(self, redValue: float, greenValue: float, blueValue: float) Resets the transparency list to single red, green, and blue values.
- Parameters
value (float) –
-
isEmpty
(self) → bool¶ True if there are no entries in the pixel lists except the nodata value
- Return type
bool
-
readXml
(self, elem: QDomElement)¶ Reads the transparency information from an XML document.
- Parameters
elem (QDomElement) –
-
setTransparentSingleValuePixelList
(self, newList: Iterable[QgsRasterTransparency.TransparentSingleValuePixel])¶ Sets the transparent single value pixel list, replacing the whole existing list.
See also
- Parameters
newList (Iterable[QgsRasterTransparency.TransparentSingleValuePixel]) –
-
setTransparentThreeValuePixelList
(self, newList: Iterable[QgsRasterTransparency.TransparentThreeValuePixel])¶ Sets the transparent three value pixel list, replacing the whole existing list.
See also
- Parameters
newList (Iterable[QgsRasterTransparency.TransparentThreeValuePixel]) –
-
transparentSingleValuePixelList
(self) → List[QgsRasterTransparency.TransparentSingleValuePixel]¶ Returns the transparent single value pixel list.
See also
- Return type
-
transparentThreeValuePixelList
(self) → List[QgsRasterTransparency.TransparentThreeValuePixel]¶ Returns the transparent three value pixel list.
See also
- Return type
-
writeXml
(self, doc: QDomDocument, parentElem: QDomElement)¶ Writes the transparency information to an XML document.
- Parameters
doc (QDomDocument) –
parentElem (QDomElement) –
-
class