If a bitmap file of an image format that supports transparency via background masking is loaded via :loadFile(), the :transparentClr instance variable is updated to contain the transparent color specified in the file. If no transparent color is specified in the image (or the image format does not support transparency), :loadFile() sets :transparentClr to GRA_CLR_INVALID. Likewise, if a bitmap is to be saved to disk using the :saveFile() method, the transparent color specified in the :transparentClr instance variable is written into the image file if supported by the image format chosen.
Member variable XbpBitmap():transparentClr Foundation
Transparent color in the image.
The :transparentClr instance variable specifies the background (key) color of the image, that is, the color of the area of the bitmap that should be displayed transparent by the :draw() method. This process is called background masking or chroma keying. By default, :transparentClr contains the value GRA_CLR_INVALID which denotes "no transparency". To set transparency for a bitmap, specify an RGB color value in this instance variable prior to calling :draw(). Alternatively, you may use one of the colors predefined in XBP.CH (XBPSYSCLR_) or GRA.CH (GRA_CLR_).
Format | Description |
---|---|
GIF | Compuserve Graphics Interchange Format |
PNG | Portable Network Graphics. Note: This format also supports per-pixel transparency (alpha channel) in images with 32 Bit color depth. If per-pixel transparency is used, the value in :transparentClr is ignored. |
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.