GpiQueryRGBColor: Difference between revisions
Appearance
Created page with "This function returns the actual RGB color that results from a particular index on the currently-associated device. ==Syntax== GpiQueryRGBColor(hps, flOptions, lColorIndex) ==Parameters== ; hps (HPS) - input : Presentation-space handle. ; flOptions (ULONG) - input : Options. :; LCOLOPT_REALIZED :: If this is specified, the information is required for when the logical color table is realized. :: If it is not specified (flag is not set) the information is requi..." |
mNo edit summary |
||
| Line 5: | Line 5: | ||
==Parameters== | ==Parameters== | ||
; hps ([[HPS]]) - input | ; hps ([[HPS]]) - input: Presentation-space handle. | ||
: Presentation-space handle. | ; flOptions ([[ULONG]]) - input: Options. | ||
:: LCOLOPT_REALIZED | |||
; flOptions ([[ULONG]]) - input | |||
: Options. | |||
: | |||
:: If this is specified, the information is required for when the logical color table is realized. | :: If this is specified, the information is required for when the logical color table is realized. | ||
:: If it is not specified (flag is not set) the information is required for when the logical color table (if any) is not realized. | :: If it is not specified (flag is not set) the information is required for when the logical color table (if any) is not realized. | ||
:: Other bits are reserved, and must be 0. | :: Other bits are reserved, and must be 0. | ||
; lColorIndex ([[LONG]]) - input: Color index. | |||
; lColorIndex ([[LONG]]) - input | |||
: Color index. | |||
: This can be any normally valid color index value (see [[GpiSetColor]]) except CLR_DEFAULT. When using the system color table, it can also be any SYSCLR_* value. | : This can be any normally valid color index value (see [[GpiSetColor]]) except CLR_DEFAULT. When using the system color table, it can also be any SYSCLR_* value. | ||
==Return Value== | ==Return Value== | ||
; lRgbColor ([[LONG]]) - returns | ; lRgbColor ([[LONG]]) - returns: RGB color providing closest match to the specified color index. | ||
: RGB color providing closest match to the specified color index. | :: >=0 - RGB color providing closest match | ||
: | :: GPI_ALTERROR - Error. | ||
: | |||
==Remarks== | ==Remarks== | ||
| Line 32: | Line 24: | ||
==Errors== | ==Errors== | ||
Possible returns from WinGetLastError: | Possible returns from WinGetLastError: | ||
; PMERR_INV_HPS (0x207F) | ; PMERR_INV_HPS (0x207F): An invalid presentation-space handle was specified. | ||
: An invalid presentation-space handle was specified. | ; PMERR_PS_BUSY (0x20F4): An attempt was made to access the presentation space from more than one thread simultaneously. | ||
; PMERR_PS_BUSY (0x20F4) | ; PMERR_INV_COLOR_OPTIONS (0x2057): An invalid options parameter was specified with a logical color table or color query function. | ||
: An attempt was made to access the presentation space from more than one thread simultaneously. | ; PMERR_INV_COLOR_INDEX (0x2056): An invalid color index parameter was specified with GpiQueryRGBColor. | ||
; PMERR_INV_COLOR_OPTIONS (0x2057) | |||
: An invalid options parameter was specified with a logical color table or color query function. | |||
; PMERR_INV_COLOR_INDEX (0x2056) | |||
: An invalid color index parameter was specified with GpiQueryRGBColor. | |||
==Example Code== | ==Example Code== | ||
This example uses the GpiQueryRGBColor call to determine if the color white is available. | This example uses the GpiQueryRGBColor call to determine if the color white is available. | ||
<pre> | <pre> | ||
#define INCL_GPILOGCOLORTABLE | #define INCL_GPILOGCOLORTABLE | ||
#include | #include <OS2.H> | ||
LONG lResult; /* closest match to the specified index */ | LONG lResult; /* closest match to the specified index */ | ||
| Line 70: | Line 45: | ||
/* logical color table is realized. */ | /* logical color table is realized. */ | ||
lResult = GpiQueryRGBColor(hps, | lResult = GpiQueryRGBColor(hps, flOptions, lColorIndex ); | ||
</pre> | </pre> | ||
[[Category:Gpi]] | [[Category:Gpi]] | ||
Latest revision as of 01:37, 17 November 2025
This function returns the actual RGB color that results from a particular index on the currently-associated device.
Syntax
GpiQueryRGBColor(hps, flOptions, lColorIndex)
Parameters
- hps (HPS) - input
- Presentation-space handle.
- flOptions (ULONG) - input
- Options.
- LCOLOPT_REALIZED
- If this is specified, the information is required for when the logical color table is realized.
- If it is not specified (flag is not set) the information is required for when the logical color table (if any) is not realized.
- Other bits are reserved, and must be 0.
- lColorIndex (LONG) - input
- Color index.
- This can be any normally valid color index value (see GpiSetColor) except CLR_DEFAULT. When using the system color table, it can also be any SYSCLR_* value.
Return Value
- lRgbColor (LONG) - returns
- RGB color providing closest match to the specified color index.
- >=0 - RGB color providing closest match
- GPI_ALTERROR - Error.
Remarks
If an RGB logical color table has been loaded, this function returns the nearest RGB color. This function is then equivalent to GpiQueryNearestColor.
Errors
Possible returns from WinGetLastError:
- PMERR_INV_HPS (0x207F)
- An invalid presentation-space handle was specified.
- PMERR_PS_BUSY (0x20F4)
- An attempt was made to access the presentation space from more than one thread simultaneously.
- PMERR_INV_COLOR_OPTIONS (0x2057)
- An invalid options parameter was specified with a logical color table or color query function.
- PMERR_INV_COLOR_INDEX (0x2056)
- An invalid color index parameter was specified with GpiQueryRGBColor.
Example Code
This example uses the GpiQueryRGBColor call to determine if the color white is available.
#define INCL_GPILOGCOLORTABLE #include <OS2.H> LONG lResult; /* closest match to the specified index */ HPS hps; /* Presentation space handle. */ ULONG flOptions; /* options */ LONG lColorIndex; /* color index */ lColorIndex = CLR_WHITE; flOptions = LCOLOPT_REALIZED; /* information is required for when the */ /* logical color table is realized. */ lResult = GpiQueryRGBColor(hps, flOptions, lColorIndex );