Compartilhar via


IBitmapImage::SetPalette

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

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
Windows Embedded CE Windows CE 5.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

IBitmapImage
ColorPalette