Color Class

A Color object stores a 32-bit value that represents a color. The color value contains four, 8-bit components: alpha, red, green, and blue. The first 8 bits (the most significant) contain the alpha component, the next 8 bits contain the red component, the next 8 bits contain the green component, and the next 8 bits (the least significant) contain the blue component. The 32-bit value is stored in a variable of type ARGB.

Color has these types of members:

Constructors

The Color class has these constructors.
Constructor Description
Color::Color() Creates a Color::Color object and initializes it to opaque black. This is the default constructor.
Color::Color(ARGB) Creates a Color::Color object by using an ARGB value.
Color::Color(BYTE,BYTE,BYTE) Creates a Color::Color object by using specified values for the red, green, and blue components. This constructor sets the alpha component to 255 (opaque).
Color::Color(BYTE,BYTE,BYTE,BYTE) Creates a Color::Color object by using specified values for the alpha, red, green, and blue components.
 

Methods

The Color class has these methods.
Method Description
Color::GetA The Color::GetA method gets the alpha component of this Color object.
Color::GetAlpha The Color::GetAlpha method gets the alpha component of this Color object.
Color::GetB The Color::GetB method gets the blue component of this Color object.
Color::GetBlue The Color::GetBlue method gets the blue component of this Color object.
Color::GetG The Color::GetG method gets the green component of this Color object.
Color::GetGreen The Color::GetGreen method gets the green component of this Color object.
Color::GetR The Color::GetR method gets the red component of this Color object.
Color::GetRed The Color::GetRed method gets the red component of this Color object.
Color::GetValue The Color::GetValue method gets the ARGB value of this Color object.
Color::MakeARGB The Color::MakeARGB method creates a 32-bit value that consolidates the specified alpha, red, green, and blue components.
Color::SetFromCOLORREF The Color::SetFromCOLORREF method uses a GDICOLORREF value to set the ARGB value of this Color object.
Color::SetValue The Color::SetValue method sets the color of this Color object.
Color::ToCOLORREF The Color::ToCOLORREF method converts this Color object's ARGB value to a GDICOLORREF value.

Methods

The Color class has these methods.

Method Description
Color::Color Creates a Color::Color object and initializes it to opaque black. This is the default constructor.
Color::Color Creates a Color::Color object by using specified values for the red, green, and blue components. This constructor sets the alpha component to 255 (opaque).
Color::Color Creates a Color::Color object by using specified values for the alpha, red, green, and blue components.
Color::Color Creates a Color::Color object by using an ARGB value.
Color::GetA The Color::GetA method gets the alpha component of this Color object.
Color::GetAlpha The Color::GetAlpha method gets the alpha component of this Color object.
Color::GetB The Color::GetB method gets the blue component of this Color object.
Color::GetBlue The Color::GetBlue method gets the blue component of this Color object.
Color::GetG The Color::GetG method gets the green component of this Color object.
Color::GetGreen The Color::GetGreen method gets the green component of this Color object.
Color::GetR The Color::GetR method gets the red component of this Color object.
Color::GetRed The Color::GetRed method gets the red component of this Color object.
Color::GetValue The Color::GetValue method gets the ARGB value of this Color object.
Color::MakeARGB The Color::MakeARGB method creates a 32-bit value that consolidates the specified alpha, red, green, and blue components.
Color::SetFromCOLORREF The Color::SetFromCOLORREF method uses a Windows Graphics Device Interface (GDI)COLORREF value to set the ARGB value of this Color object.
Color::SetValue The Color::SetValue method sets the color of this Color object.
Color::ToCOLORREF The Color::ToCOLORREF method converts this Color object's ARGB value to a Windows Graphics Device Interface (GDI)COLORREF value.

Remarks

The alpha component, the most significant 8 bits, specifies the transparency of a color. All four component values range from 0 to 255. An alpha component value of 0 specifies that the color is transparent, and an alpha value of 255 specifies that the color is opaque. Alpha component values from 1 through 254 specify the degree to which the color is blended with the background when the color is rendered. The red, green, and blue color component values range from 0 to 255 and determine the intensity of the color. The Color::MakeARGB method is used to encapsulate the four color components into a single 32-bit value.

Requirements

   
Target Platform Windows
Header gdipluscolor.h