Jump to content

GreQueryColorData

From EDM2
Revision as of 23:20, 24 March 2020 by Ak120 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

GreQueryColorData stores an array of information about the currently available logical color table and device colors at the location addressed by pArray.

This function must be supported by the presentation driver. GreQueryColorData is called by GpiQueryColorData in response to an application's request for the currently selected color table data for the device context. This function can be handled by bit-map simulation.

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

Syntax

GreQueryColorData(hdc, cArray, pArray, pInstance, lFunction)

Parameters

hdc (HDC) - input
Device context handle.
cArray (LONG) - input
Number of elements supplied in Array.
pArray (PLONG) - input
Pointer to Array.
On return, this array contains:
lArray[QCD_LCT_FORMAT]
Format of loaded color table (if any):
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
DC has a palette selected.
lArray[QCD_LCT_LOINDEX]
Smallest color index loaded (always 0).
lArray[QCD_LCT_HIINDEX]
Largest color index loaded (never less than 15).
Information is only returned for the number of elements supplied. Any extra elements supplied must be zeroed by the handling routine.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreQueryColorData.

Returns

rc (BOOL) - returns
Return Code.
On completion, the handling routine must return a BOOLEAN value to indicate success or an error.
  • TRUE Successful
  • FALSE Error

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_HDC
  • PMERR_INV_LENGTH_OR_COUNT

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. */
LONG     cArray;     /*  Number of elements supplied in Array. */
PLONG    pArray;     /*  Pointer to Array. */
PVOID    pInstance;  /*  Pointer to instance data. */
ULONG    lFunction;  /*  High-order WORD=flags; low-order WORD=NGreQueryColorData. */
BOOL     rc;         /*  Return Code. */

rc = GreQueryColorData(hdc, cArray, pArray, pInstance, lFunction);

Remarks

When the current table is the default logical color table, presentation drivers that support less than 16 colors return the device colors to which the 16 colors from 0 (CLR_BACKGROUND) through 15 (CLR_PALEGRAY) have been mapped.