GpiQueryColorData
Appearance
Information about the current logical color table or the selected palette is returned by this function.
Syntax
GpiQueryColorData(hps, lCount, alArray)
Parameters
- hps (HPS) - input
- Presentation-space handle.
- lCount (LONG) - input
- Number of elements supplied in alArray.
- It must be between 0 and 4.
- alArray (PLONG) - output
- Array.
- On return this array contains:
- alArray[QCD_LCT_FORMAT]
- Format of loaded color table if any. One of the following values is returned:
- LCOLF_DEFAULT
- Default color table is in force.
- LCOLF_INDRGB
- Color table loaded which provides translation from index to RGB.
- LCOLF_RGB
- Color index = RGB.
- LCOLF_PALETTE
- Palette is selected.
- alArray[QCD_LCT_LOINDEX]
- Smallest color index in the color table or palette; always zero for color tables.
- alArray[QCD_LCT_HIINDEX]
- Largest color index in the color table or palette; never less than 15 for color tables.
- alArray[QCD_LCT_OPTIONS]
- Color table or palette option. Zero or more of the following are returned:
- LCOL_PURECOLOR
- No color dithering (color table or selected palette).
- LCOL_OVERRIDE_DEFAULT_COLORS
- Override for applications that need the full hardware palette (selected palette only).
- The array elements are numbered consecutively, starting with alArray. The element number constants start with 0.
- Information is returned only for the number of elements supplied. Any extra elements supplied, beyond those described above, are set to zero by the system.
Return Value
- rc (BOOL) - returns
- Success indicator.
- TRUE
- Successful completion
- FALSE
- Error occurred.
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_LENGTH_OR_COUNT (0x2092)
- An invalid length or count parameter was specified.
Example Code
#define INCL_GPILOGCOLORTABLE /* Or use INCL_GPI, INCL_PM, */ #include <os2.h> HPS hps; /* Presentation-space handle. */ LONG lCount; /* Number of elements supplied in . */ PLONG alArray; /* Array. */ BOOL rc; /* Success indicator. */ rc = GpiQueryColorData(hps, lCount, alArray);
This example uses the GpiQueryColorData function to retrieve the smallest color-table index. The GpiQueryLogColorTable function is then used to retrieve the RGB color value for this index.
#define INCL_GPILOGCOLORTABLE /* Color Table functions */ #include <os2.h> HPS hps; /* presentation space handle */ LONG alData[3]; /* information array */ LONG alColor[1]; /* information array */ GpiQueryColorData(hps, 3L, alData); GpiQueryLogColorTable(hps, 0L, alData[QCD_LCT_LOINDEX], 1L, alColor);