GreQueryRGBColor

GreQueryRGBColor returns the actual RGB color that results from the specified color index for the specified device. If the color index is RGB mode, the nearest RGB color (the same as QueryNearestColor) is returned.

This function must be supported by the presentation driver. GreQueryRGBColor is called by GpiQueryRGBColor in response to the request of an application to convert a color index into the corresponding RGB value. If the logical table is currently in RGB mode, the nearest RGB color is returned. This function can be handled by bit-map simulation.


 * Simulation support: None. This function is mandatory for all drivers.

Syntax
GreQueryRGBColor(hdc, flOptions, iColor, pInstance, lFunction);

Parameters

 * hdc (HDC) - input : Device context handle.


 * flOptions (ULONG) - input : Options flag.


 * Valid options are:


 * LCOLOPT_REALIZED: If set, the information is required when the logical color table (if any) is realized. When this flag is not set, the information is required when the logical color table is not realized.


 * LCOLOPT_INDEX: When set, the handling routine must return the actual RGB color originally specified for this index. Otherwise, it must return the nearest RGB color for this index, that is, the one which would result from drawing on the specified device.

Other flags are reserved and must be 0.


 * iColor (LONG) - input : Color index.


 * pInstance (PVOID) - input : Pointer to instance data.


 * lFunction (ULONG) - input : High-order WORD=flags; low-order WORD=NGreQueryRGBColor.

Returns

 * rc (LONG) - returns : Return Code.

On completion, the handling routine must return the nearest available RGB color to that requested (rgbColor), or GPI_ALTERROR if an error occurred.

Possible Errors Detected: When an error is detected, the handling routine must call WinSetErrorInfo to post the condition. Error codes for conditions that the handling routine is expected to check include:


 * PMERR_DEV_FUNC_NOT_INSTALLED
 * PMERR_INV_COLOR_DATA
 * PMERR_INV_COLOR_INDEX
 * PMERR_INV_COLOR_OPTIONS
 * PMERR_INV_HDC

Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.

Sample

 * 1) define INCL_GRE_COLORTABLE
 * 2) include 

HDC     hdc;        /*  Device context handle. */ ULONG   flOptions;  /*  Options flag. */ LONG    iColor;     /*  Color index. */ PVOID   pInstance;  /*  Pointer to instance data. */ ULONG   lFunction;  /*  High-order WORD=flags; low-order WORD=NGreQueryRGBColor. */ LONG    rc;         /*  Return Code. */

rc = GreQueryRGBColor(hdc, flOptions, iColor,      pInstance, lFunction);

Remarks
All defined colors are valid except CLR_DEFAULT, which causes an error to be raised.