From Appmethod Libraries
Jump to: navigation, search

Object Pascal

type TAlphaColor = Cardinal;


typedef unsigned TAlphaColor;


Type Visibility Source Unit Parent
System.UITypes System.UITypes


TAlphaColor is used to specify alpha colors.

TAlphaColor is used to specify the alpha color to be displayed for a visual component. It is used by the Color property of many components and by a number of other properties that specify color values.

Alpha colors constants are defined by the TAlphaColorRec record. The System.UIConsts unit also contains definitions of useful constants for TAlphaColor. The names of the constants from System.UIConsts are composed of the cla prefix and the color names defined by the TAlphaColorRec record. These constants map directly to the closest matching color in the system palette (for example, claBlue maps to blue).

TAlphaColor is formed of four channels (ARGB) specified as 4-byte hexadecimal number. The low three bytes represent RGB color channels, intensities for blue, green, and red, respectively, and the highest-order byte is the transparency coefficient (Alpha channel). The value $FFFF0000 (Object Pascal) or 0xFFFF0000 (C++) represents full-intensity, pure blue, $FF00FF00 (Object Pascal) or 0xFF00FF00 (C++) is pure green, and $FF0000FF (Object Pascal) or 0xFF0000FF (C++) is pure red. $FF000000 (Object Pascal) or 0xFF000000 (C++) is black and $FFFFFFFF (Object Pascal) or 0xFFFFFFFF (C++) is white.

To set the color of an object, you can also use TColorAnimation or TColorKeyAnimation.

For a list of the predefined colors, see TAlphaColorRec.

There are three ways to set a color:

 Color := claGreen; //Object Pascal
 Color = TAlphaColor(claGreen); // C++
 Color := TAlphaColorRec.Green; //Object Pascal
 Color = TAlphaColor(TAlphaColorRec::Green); // C++
  • Using the 4-byte hexadecimal number representation:
 Color := $FF008000;  // Object Pascal
 Color = TAlphaColor(0xFF008000); // C++

See Also

Code Examples