IBitmapImage::SetPalette (Windows CE 5.0)

Send Feedback

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

HRESULT SetPalette(  const ColorPalette* palette);


  • 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 Values

If successful, this method returns S_OK.

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


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


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.


OS Versions: Windows CE 5.0 and later.
Header: Imaging.h.
Link Library: Imaging.lib.

See Also

IBitmapImage | ColorPalette

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.