Member variable XbpBitmap():hasAlphaChannel Foundation

Specifies whether the image has an alpha channel.

Attribute: EXPORTED
Data type: Logical (.F.)
Description

The :hasAlphaChannel instance variable contains a logical value which specifies whether an alpha channel is present in the image. If :hasAlphaChannel is .T. (true), the raster image uses an alpha channel which means that transparency information was saved for each pixel in the image along with the pixel's color value.

Per-pixel transparency is supported by the following image formats:

Image formats supporting an alpha channel
Image Format Description
Windows Bitmap Default Windows bitmap format. Supported in images with a color depth of 32 bits per pixel. See note below.
PNG Portable Network Graphics format. Supported in images with a color depth of 32 bits per pixel.

The value in :hasAlphaChannel is set by methods such as :load() and :loadFile(), depending on the transparency information found in the image. The value can be changed by the application before drawing the bitmap using the :draw() method, for example, for enabling per-pixel transparency for the raster image.

Note on Windows Bitmaps: Many graphics packages do not support per-pixel transparency in Windows Bitmap files. Consequently, the information stored in the alpha channel of such image files is unreliable and cannot be used to determine whether the image actually uses the alpha channel. For this reason, :hasAlphaChannel is always .F. (false) after loading Windows Bitmap files using :loadFile() or :load(). However, applications can assign .T. (true) to :hasAlphaChannel prior to output via :draw() for Windows Bitmaps known to have an alpha channel.

Background masking (chroma keying) is not supported for images with an alpha channel. This means that the value in :transparentClr is ignored in this case.

Feedback

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.