COLORREF RGB(cRed, cGreen, cBlue) | |||||
BYTE cRed; | /* red component of color, */ | ||||
BYTE cGreen; | /* green component of color | */ | |||
BYTE cBlue; | /* blue component of color | */ |
The RGB macro selects an RGB color based on the parameters supplied and the color capabilities of the output device.
cRed
Specifies the intensity of the red color field.
cGreen
Specifies the intensity of the green color field.
cBlue
Specifies the intensity of the blue color field.
The return value specifies the resultant RGB color.
The intensity for each argument can range from 0 through 255. If all three intensities are specified as zero, the result is black. If all three intensities are specified as 255, the result is white.
For information on using color values in a color palette, see the descriptions of the PALETTEINDEX and PALETTERGB macros earlier in this chapter.
The RGB macro is defined in WINDOWS.H as follows:
#define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)(g)<<8))| \
(((DWORD)(BYTE)(b))<<16)))