Edit

CreateHalftonePalette function (wingdi.h)

The CreateHalftonePalette function creates a halftone palette for the specified device context (DC).

Syntax

HPALETTE CreateHalftonePalette(
  [in] HDC hdc
);

Parameters

[in] hdc

A handle to the device context.

Return value

If the function succeeds, the return value is a handle to a logical halftone palette.

If the function fails, the return value is zero.

Remarks

An application should create a halftone palette when the stretching mode of a device context is set to HALFTONE. The logical halftone palette returned by CreateHalftonePalette should then be selected and realized into the device context before the StretchBlt or StretchDIBits function is called.

The halftone palette contains the 20 static system colors plus a device-independent set of colors (a 6x6x6 RGB color cube and additional gray shades) chosen to approximate a wide range of colors when an image is dithered. The exact color entries are an implementation detail and are not guaranteed to be identical across devices or Windows versions; applications should not depend on specific palette values or on any particular dithering algorithm. To inspect the entries at run time, call GetPaletteEntries on the returned palette handle.

When you no longer need the palette, call the DeleteObject function to delete it.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wingdi.h (include Windows.h)
Library Gdi32.lib
DLL Gdi32.dll

See also

Color Functions

Colors Overview

DeleteObject

GetPaletteEntries

RealizePalette

SelectPalette

SetStretchBltMode

StretchBlt

StretchDIBits