ColorInfo

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

The ColorInfo function 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.

Parameters

lpDestDev

Points to a PDEVICE or PBITMAP structure specifying the destination device or bitmap.

dwColorin

Specifies either a logical or physical color, depending on the value of lpPColor parameter.

lpPColor

Points to 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.

Return Value

The return value is the logical color (RGB value) that most closely matches the physical color either specified by dwColorin, or copied to the PCOLOR structure pointed to by lpPColor.

Comments

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 return 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 indexes for all other colors. If GDI receives a color index from ColorInfo, it uses other functions to determine the corresponding logical color.

See Also

Pixel