CGDIPalette Class

class CGDIPalette: public CGDIObject

Encapsulates a GDI palette object.

Defined in: GDIObjects.h

Class Members

CGDIPalette(HPALETTE h = NULL, bool bOwn = true)

Attach constructor. Initializes a new instance of CGDIPalette and optionally attaches a previously existing palette handle. The ownership of this handle is determined by the bOwn parameter.

CGDIPalette(CGDIPalette& rhs, bool bTransferOwnership = true)

Copy constructor. Takes an existing CGDIPalette instance and copies its contents to the new instance being constructed. If the object being copied is the owner of the handle, ownership's transference is controlled by the parameter bTransferOwnership.

CGDIPalette& operator =(CGDIPalette& rhs)

Copies the contents of the passed object into this instance. Ownership is always transfered if it belongs to the object being copied.

bool CreatePalette(LPLOGPALETTE lpLogPalette)

Creates a new palette

bool CreateHalftonePalette(HDC hdc)

Creates a new halftone palette

int GetEntryCount()

Retrieves number of palette entries

UINT GetPaletteEntries(UINT nStartIndex, UINT nNumEntries, LPPALETTEENTRY lpPaletteColors) const

Retrieves a specified range of entries in the palette

UINT SetPaletteEntries(UINT nStartIndex, UINT nNumEntries, LPPALETTEENTRY lpPaletteColors)

Set the values of a specified range of entries in the palette

void AnimatePalette(UINT nStartIndex, UINT nNumEntries, LPPALETTEENTRY lpPaletteColors)

Replaces entries in a specified range of the palette

UINT GetNearestPaletteIndex(COLORREF crColor) const

Retrieves the closest match to the given color

bool ResizePalette(UINT nNumEntries)

Changes the number of entries in the palette