From RAD Studio API Documentation
Jump to: navigation, search


TAlphaColor = type 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 (Delphi) or 0xFFFF0000 (C++) represents full-intensity, pure red, $FF00FF00 (Delphi) or 0xFF00FF00 (C++) is pure green, and $FF0000FF (Delphi) or 0xFF0000FF (C++) is pure blue. $FF000000 (Delphi) or 0xFF000000 (C++) is black and $FFFFFFFF (Delphi) 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; //Delphi
 Color = TAlphaColor(claGreen); // C++
 Color := TAlphaColorRec.Green; //Delphi
 Color = TAlphaColor(TAlphaColorRec::Green); // C++
  • Using the 4-byte hexadecimal number representation:
 Color := $FF008000;  // Delphi
 Color = TAlphaColor(0xFF008000); // C++

See Also

Code Examples