The red, green, and blue (RGB) components of a color are stored in either an RGB or RGB2 data structure, or as a long integer (32-bit) value. The color fields in the RGB2 structure and in the long integer follow the same rules.

If stored as a long integer, the RGB value has the first 8 bits reserved for a flag value and the remaining 24 bits reserved for color intensity. The flag byte must be set to 0. Each of the last three bytes specifies a color intensity, in the range 0 through 255, for a single primary color.

If a byte contains 0, the corresponding primary color is not present. As the value in the byte increases, the intensity of the primary color increases. For example, if the byte contains 128, the primary color is pale; if the byte contains 255, the primary color is as intense as the device permits.

The RGB value is determined by the following equation:

    RGB Value = (R * 65536) + (G * 256) + B

    Where:
        R is the red intensity
        G is the green intensity
        B is the blue intensity

If all three bytes are set to 0, the resulting color is black; if they all are set to 255, the resulting color is white. The RGB value associated with each of the standard eight colors is in the following table.

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Color               ³RGB value           ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³Black               ³0x00000000          ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³Red                 ³0x00FF0000          ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³Green               ³0x0000FF00          ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³Blue                ³0x000000FF          ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³Pink                ³0x00FF00FF          ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³Cyan                ³0x0000FFFF          ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³Yellow              ³0x00FFFF00          ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³White               ³0x00FFFFFF          ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ


[Back] [Next]