Applies transparency to an image based on the settings in Transparent, TransparentColor, and TransparentMode.
Source position: graphics.pp line 1332
protected procedure TRasterImage.ApplyTransparent; |
ApplyTransparent is a method which applies transparency to the image. It is called when one of the values in Transparent, TransparentColor, or TransparentMode is changed.
While the transparency mechanism today is based on the alpha channel in an image, the older color transparency is still supported in TBitmap. This means that pixels which have a specified color are not painted, and this way the image appears to be "transparent".
There are two TransparentMode settings related to how the transparent color is defined: in tmAuto the color in the lower/left corner of the image is considered to be transparent, while in tmFixed the color must be explicitly specified by the user in the TransparentColor property (where the default setting, clDefault, again behaves in the same way as tmAuto).
In Delphi, setting the Transparent property in TBitmap is enough to render a bitmap as transparent in tmAuto mode. ApplyTransparent provides a measure of Delphi compatibility by ensuring that all of the transparency-related properties are respected while ignoring the order in which they are specified.
ApplyTransparent resets the handle for the Mask image when allocated. It calls SetMasked to apply the new transparency setting and to call the Changed method for the class instance.
Added in LCL version 4.2.
|
Color used to represent transparent pixels in the image. |
|
|
Determines how transparent pixels are represented in the image. |
|
|
Applies the color used for transparent pixels to the image. |
|
|
Masked - returns True if a Mask is being applied. |
|
|
Sets the value for the Masked property. |
|
|
Changed - method to call when properties have changed. |
|
|
MaskHandleAllocated - returns True if a handle has been allocated for the Mask. |
|
|
Indicates whether some parts of the image are not opaque. |
| CT Web help |
| CodeTyphon Studio |