Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This method creates an in-memory bitmap image object from another image object.

Syntax

HRESULT CreateBitmapFromImage(
  IImage*			
image,
  OPTIONAL UINT	
width,
  OPTIONAL UINT	
height,
  OPTIONAL PixelFormatID 
pixelFormat,
  InterpolationHint
hints,
  IBitmapImage**		 
bitmap
);

Parameters

image

[in] A pointer to an IImageinterface containing the original image data.

width

[in] A UINT value that specifies the width, in pixels, of the new bitmap image.

Set this value to 0 create a new bitmap image that is the same height as the source image.

height

[in] A UINT value that specifies the height, in pixels, of the new bitmap image.

Set this value to 0 create a new bitmap image that is the same width as the source image.

pixelFormat

[in] A PixelFormatID value that specifies the numerical format of the pixels in the image. For more information, see PixelFormat Values.

Set this value to PixelFormatDontCare to create a new bitmap image that has the same pixel format as the source image.

hints

[in] An InterpolationHintenumeration value that specifies the interpolation technique that this method should use when resizing the bitmap.

bitmap

[out] A pointer to the resulting IBitmapImageinterface pointer.

Use the interface to access the bitmap image created by this method.

Return Value

If successful, this method returns S_OK.

This method may return E_POINTER if it fails.

Remarks

This method is convenient for converting a bitmap image object of one pixel format into another object of a different 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