Unit 'Graphics' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#lcl]

TRasterImage.ApplyTransparent

Applies transparency to an image based on the settings in Transparent, TransparentColor, and TransparentMode.

Declaration

Source position: graphics.pp line 1332

protected procedure TRasterImage.ApplyTransparent;

Description

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.

Version info

Added in LCL version 4.2.

See also

TRasterImage.TransparentColor

  

Color used to represent transparent pixels in the image.

TRasterImage.TransparentMode

  

Determines how transparent pixels are represented in the image.

TRasterImage.Mask

  

Applies the color used for transparent pixels to the image.

TRasterImage.Masked

  

Masked - returns True if a Mask is being applied.

TRasterImage.SetMasked

  

Sets the value for the Masked property.

TRasterImage.Changed

  

Changed - method to call when properties have changed.

TRasterImage.MaskHandleAllocated

  

MaskHandleAllocated - returns True if a handle has been allocated for the Mask.

TGraphic.Transparent

  

Indicates whether some parts of the image are not opaque.



CT Web help

CodeTyphon Studio