GreQueryRGBColor: Difference between revisions
Created page with "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 ..." |
mNo edit summary |
||
Line 1: | Line 1: | ||
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. | 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. | 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. | ;Simulation support: None. This function is mandatory for all drivers. | ||
== Syntax == | == Syntax == | ||
GreQueryRGBColor(hdc, flOptions, iColor, pInstance, lFunction) | GreQueryRGBColor(hdc, flOptions, iColor, pInstance, lFunction) | ||
== Parameters == | == Parameters == | ||
; hdc (HDC) - input : Device context handle. | ;hdc (HDC) - input : Device context handle. | ||
;flOptions (ULONG) - input : Options flag. | |||
; 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. | |||
: Valid options are: | :;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. | |||
:;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. | ;iColor (LONG) - input : Color index. | ||
;pInstance (PVOID) - input : Pointer to instance data. | |||
:;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. | ;lFunction (ULONG) - input : High-order WORD=flags; low-order WORD=NGreQueryRGBColor. | ||
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 == | == Returns == | ||
; rc (LONG) - returns : Return Code. | ;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. | |||
On completion, the handling routine must return the nearest available RGB color to that requested (rgbColor), or GPI_ALTERROR if an error occurred. | |||
*PMERR_DEV_FUNC_NOT_INSTALLED | 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_INV_COLOR_DATA | *PMERR_DEV_FUNC_NOT_INSTALLED | ||
*PMERR_INV_COLOR_INDEX | *PMERR_INV_COLOR_DATA | ||
*PMERR_INV_COLOR_OPTIONS | *PMERR_INV_COLOR_INDEX | ||
*PMERR_INV_HDC | *PMERR_INV_COLOR_OPTIONS | ||
*PMERR_INV_HDC | |||
Refer to the "Error Explanations" section in the ''Presentation Manager Programming Reference'' for further explanation. | |||
== Sample == | == Sample == | ||
<pre> | <pre> | ||
Line 53: | Line 43: | ||
LONG rc; /* Return Code. */ | LONG rc; /* Return Code. */ | ||
rc = GreQueryRGBColor(hdc, flOptions, iColor, | rc = GreQueryRGBColor(hdc, flOptions, iColor, pInstance, lFunction); | ||
</pre> | </pre> | ||
== Remarks == | == Remarks == | ||
All defined colors are valid except CLR_DEFAULT, which causes an error to be raised. | All defined colors are valid except CLR_DEFAULT, which causes an error to be raised. | ||
[[Category:Gre]] | [[Category:Gre]] |
Latest revision as of 01:07, 25 March 2020
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
#define INCL_GRE_COLORTABLE #include <os2.h> 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.