Partager via


IBitmapImage::SetPalette (Compact 2013)

3/26/2014

This feature is being deprecated for this release. Refer to this component: Windows Imaging Component.

This method sets the color palette associated with a bitmap image.

Syntax

HRESULT SetPalette(
  const ColorPalette* palette
);

Parameters

  • palette
    [in] A pointer to a ColorPalette structure containing data for the bitmap image's new color palette.

    The IBitmapImage::SetPalette method makes a copy of the palette and attaches it to the bitmap image.

Return Value

If successful, this method returns S_OK.

If it fails, this method should return one of the following error values:

  • IMGERR_OBJECTBUSY
  • E_INVALIDARG
  • E_OUTOFMEMORY

For more information, see Error Codes for the Imaging API.

Remarks

The following indexed color pixel formats are for a bitmap image that requires a color palette.

  • PixelFormat1bppIndexed
  • PixelFormat4bppIndexed
  • PixelFormat8bppIndexed

If no pixel format is specified for the bitmap image, the IBitmapImage::SetPalette method chooses an appropriate default color palette.

A color palette is optional for bitmap images in pixel formats other than those listed above.

If a color palette is supplied, that palette can be used when the bitmap image is displayed onto an indexed color graphics context or when the image is converted to an indexed color pixel format.

Requirements

Header

imaging.h

Library

Imaging.lib

See Also

Reference

IBitmapImage
ColorPalette