IWICBitmapFrameEncode::SetPalette method (wincodec.h)

Sets the IWICPalette for indexed pixel formats.

Syntax

HRESULT SetPalette(
  [in] IWICPalette *pIPalette
);

Parameters

[in] pIPalette

Type: IWICPalette*

The IWICPalette to use for indexed pixel formats.

The encoder may change the palette to reflect the pixel formats the encoder supports.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

This method doesn't fail if called on a frame whose pixel format is set to a non-indexed pixel format. If the target pixel format is a non-indexed format, the palette will be ignored.

If you already called IWICBitmapEncoder::SetPalette to set a global palette, this method overrides that palette for the current frame.

The palette must be specified before your first call to WritePixels/WriteSource. Doing so will cause WriteSource to use the specified palette when converting the source image to the encoder pixel format. If no palette is specified, a palette will be generated on the first call to WriteSource.

Requirements

Requirement Value
Minimum supported client Windows XP with SP2, Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header wincodec.h
Library Windowscodecs.lib
DLL Windowscodecs.dll