IImagingFactory::CreateImageFromBuffer
A version of this page is also available for
4/8/2010
This method lets the application create a decodeded image object from a buffer supplied by the application.
Syntax
HRESULT CreateImageFromBuffer(
const VOID* buf,
UINT size,
BufferDisposalFlag disposalFlag,
IImage** image
);
Parameters
- buf
[in] A VOID pointer to the buffer containing the image data.
- size
[in] A UINT value specifying the size, in bytes, of the buffer that buf points to.
disposalFlag
[in] A BufferDisposalFlag enumeration value that describes how the method should release the memory pointed to by buf after the new image is created.If the call to the IImagingFactory::CreateImageFromBuffer method fails, the caller still retains ownership of the memory buffer, regardless of what disposalFlag is set to.
- image
[out] A pointer to the resulting IImage interface pointer.
Return Value
If successful, this method returns S_OK.
If it fails, this method should return one of the following error values:
- E_INVALIDARG
- E_OUTOFMEMORY
- E_POINTER
For more information, see Error Codes for the Imaging API.
Remarks
When the decoded image object is created, it only keeps a reference to the external data source and does not immediately decode the image.
The client application can request that the buffer for the resource be disposed of when the decoded image object is released by setting an appropriate value for the parameter disposalFlag.
Be aware that decoded image objects are read-only. In particular, you cannot modify the image data. However, you can display it onto a destination graphics context or push its data into an image sink. For more information, see IImage.
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 |