typedef struct tagRGBQUAD {
BYTE rgbBlue;
BYTE rgbGreen;
BYTE rgbRed;
BYTE rgbReserved;
} RGBQUAD;
The RGBQUAD structure specifies a logical color or a 16-bit color index. A logical color specifies the color desired by an application. A color index indirectly specifies a logical color by identifying a color in an array (or table) of colors.
rgbBlue
Specifies the intensity of blue. It must be a value in the range 0 (no blue) to 255 (brightest blue).
rgbGreen
Specifies the intensity of green. It must be a value in the range 0 (no green) to 255 (brightest green).
rgbRed
Specifies the intensity of red. It must be a value in the range 0 (no red) to 255 (brightest red).
rgbReserved
Specifies whether the RGBQUAD structure specifies an RGB color or a 16-bit color index. If this member is zero, this is an RGB color. If this member is 0xFF, then the low 16 bits (rgbBlue and rgbGreen members) is a color index, not an RGB color.
When the colors are at minimum intensity (0,0,0), the result is black; when at maximum intensity (255,255,255), the result is white; and when at half intensity (127,127,127), the result is gray.
Primary colors can be combined to form new colors. For example, solid red (0,0,255) and blue (255,0,0) can form purple (255,0,255). If a device cannot display all the possible RGB color combinations, the device driver must map given RGB color values to colors the device can display. For example, in a black-and-white display with only one bit per pixel, the driver uses a cutoff intensity at which all the RGB values above the intensity are white and all below are black. One method used to compute the cutoff intensity is to add the individual color intensities according to the following formula:
((5*rgbGreen+3*rgbRed+rgbBlue)+4)>>3
If the result is greater than 128, then all the RGB values above that intensity will be white, and those below it will be black.