EngCreatePalette

HPALETTE EngCreatePalette(

    IN ULONG  iMode,
   IN ULONG  cColors,
   IN PULONG  *pulColors,
   IN FLONG  flRed,
   IN FLONG  flGreen,
   IN FLONG  flBlue
  );

EngCreatePalette sends a request to GDI to create a palette. The driver associates the new palette with a device by returning a pointer to the palette in the DEVINFO structure.

Parameters

iMode

Specifies how the palette will be defined. This parameter can be one of the following values:

Value Meaning
PAL_INDEXED An array of RGB colors is provided with cColors and pulColors.
PAL_BITFIELDS The palette is defined by the flRed, flGreen, and flBlue parameters.
PAL_RGB The device accepts RGB colors directly, with R as the least significant byte.
PAL_BGR The device accepts RGB colors directly, with B as the least significant byte.

cColors

If the iMode parameter is PAL_INDEXED, cColors specifies the number of colors provided in the array pointed to by pulColors. Otherwise, this parameter should be zero.

pulColors

Points to an array of ULONG values if iMode is PAL_INDEXED. The low-order 3 bytes of each ULONG define the RGB colors in the palette.

flRed, flGreen, and flBlue

If the iMode parameter is PAL_BITFIELDS, these parameters are masks that show which bits correspond to red, green, and blue. Each mask must consist of contiguous bits and should not overlap other masks. All combinations of bitfields are supported by GDI.

Return Value

The return value is a handle to the new palette if the function is successful. Otherwise, it is zero, and an error code is logged.

See Also

DEVINFO, DrvSetPalette, EngDeletePalette