Jump to content

GreDeviceSetPaletteEntries

From EDM2
Revision as of 23:56, 23 March 2020 by Ak120 (talk | contribs)

GreDeviceSetPaletteEntries changes the entries in a palette as a result of an application's GpiSetPalette entries request. These changes do not become apparent until an application calls WinRealizePalette. If an application wants to change its palette rapidly and makes those changes immediately apparent, it calls GpiAnimatePalette.

This function can be hooked by the presentation driver.

Simulation support
This function is simulated by a handling routine in Revision 2.0 (or later) of the graphics engine.

Syntax

GreDeviceSetPaletteEntries(hdc, hdevpal, ulFormat, ulStart, cclr, pclr, pInstance, lFunction)

Parameters

hdc (HDC) - input
Device context handle.
hdevpal (ULONG) - input
Device palette handle.
ulFormat (ULONG) - input
Specifies the entry format. Must be LCOLF_CONSECRGB.
ulStart (ULONG) - input
Starting index, that is, first palette entry to change.
cclr (ULONG) - input
Count of palette entries to change.
pclr (PULONG) - input
Pointer to table of new RGB2 palette entries.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreDeviceSetPaletteEntries.

Returns

rc (BOOL) - returns
Return codes.
This function returns BOOLEAN (fSuccess).
  • TRUE Successful, if entries set without error
  • 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_INV_IN_AREA
  • PMERR_INV_IN_PATH
  • PMERR_INV_COLOR_INDEX

Sample

#define INCL_GRE_PALETTE
#include <os2.h>

HDC       hdc;        /*  Device context handle. */
ULONG     hdevpal;    /*  Device palette handle. */
ULONG     ulFormat;   /*  Specifies the entry format. Must be LCOLF_CONSECRGB. */
ULONG     ulStart;    /*  Starting index, that is, first palette entry to change. */
ULONG     cclr;       /*  Count of palette entries to change. */
PULONG    pclr;       /*  Pointer to table of new RGB2 palette entries. */
PVOID     pInstance;  /*  Pointer to instance data. */
ULONG     lFunction;  /*  High-order WORD=flags; low-order WORD=NGreDeviceSetPaletteEntries. */
BOOL      rc;         /*  Return codes. */

rc = GreDeviceSetPaletteEntries(hdc, hdevpal,
       ulFormat, ulStart, cclr, pclr, pInstance,
       lFunction);