ColorInfo


COLORREF ColorInfo(LPPDEVICE lpDestDev, DWORD dwColorin, 
    LPPCOLOR lpPColor);

Converts a logical color (an RGB value) to a physical color (a physical color value) or converts a physical to a logical color, depending on the value of the lpPColor parameter.

Every graphics device driver must export a ColorInfo function.

lpDestDev

Address of a PDEVICE or PBITMAP structure that specifies the destination device or bitmap.

dwColorin

A logical or physical color, depending on the value of lpPColor parameter.

lpPColor

Address of a PCOLOR structure or is NULL. If lpPColor points to a PCOLOR structure, the function assumes that dwColorin specifies a logical color (an RGB value) and copies the physical color value that most closely matches the logical color to this structure. If lpPColor is NULL, the function assumes that dwColorin specifies a physical color and returns the logical color that matches the physical color.

The export ordinal for this function is 2.

When converting a logical color, ColorInfo chooses the best possible physical color to match the logical color and returns the RGB color value that corresponds to this physical color.

GDI uses the physical colors returned by ColorInfo to set text colors, background colors, and pixel colors using the Pixel function.

If dwColorin is a logical color, it may specify either an RGB value or a color index. If dwColorin specifies a color index (high-order byte is 0xFF), ColorInfo should return the index without carrying out a conversion. If dwColorin is a physical color, ColorInfo should return an RGB value only for static colors and return color indices for all other colors. If GDI receives a color index from ColorInfo, it uses other functions to determine the corresponding logical color.

See also PDEVICE, PBITMAP