IWICPalette::InitializePredefined method (wincodec.h)

Initializes the palette to one of the pre-defined palettes specified by WICBitmapPaletteType and optionally adds a transparent color.


HRESULT InitializePredefined(
  [in] WICBitmapPaletteType ePaletteType,
  [in] BOOL                 fAddTransparentColor


[in] ePaletteType

Type: WICBitmapPaletteType

The desired pre-defined palette type.

[in] fAddTransparentColor

Type: BOOL

The optional transparent color to add to the palette. If no transparent color is needed, use 0. When initializing to a grayscale or black and white palette, set this parameter to FALSE.

Return value


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


If a transparent color is added to a palette, the palette is no longer predefined and is returned as WICBitmapPaletteTypeCustom. For palettes with less than 256 entries, the transparent entry is added to the end of the palette (that is, a 16-color palette becomes a 17-color palette). For palettes with 256 colors, the transparent palette entry will replace the last entry in the pre-defined palette.


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