DrvSetPalette function (winddi.h)

The DrvSetPalette function requests that the driver realize the palette for a specified device.

Syntax

BOOL DrvSetPalette(
  DHPDEV dhpdev,
  PALOBJ *ppalo,
  FLONG  fl,
  ULONG  iStart,
  ULONG  cColors
);

Parameters

dhpdev

Handle to the physical device's PDEV structure, which identifies the device whose palette is to be realized. This parameter is the device handle returned to GDI by DrvEnablePDEV.

ppalo

Pointer to the PALOBJ structure from which the colors (RGB values) should be queried.

fl

A set of flags that provides hints and options. This parameter can be the following value:

Value Meaning
SP_DEFAULT The palette is the device's complete default palette. The PALOBJ can be ignored, but contains the correct contents.

iStart

Specifies the first palette index to overwrite.

cColors

Specifies the number of colors to change in the hardware palette. Extra colors, beyond the number available in the hardware, can be ignored. If cColors is smaller than the size of the hardware palette, set only cColors entries and leave the remaining colors as they are.

Return value

The return value is TRUE if the function is successful. Otherwise, it is FALSE, and an error code is logged.

Remarks

The driver sets the hardware palette to match the entries in the given palette as closely as possible.

Only indexed palettes are realizable. The RC_PALETTE bit of the flRasterCaps member of the GDIINFO structure specifies whether a device has a realizable palette.

DrvSetPalette is required for display drivers that support realizable palettes.

Requirements

Requirement Value
Target Platform Desktop
Header winddi.h (include Winddi.h)

See also

DrvEnablePDEV

EngCreatePalette

EngDeletePalette