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. |
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 bufpoints to.
- disposalFlag
-
[in] A BufferDisposalFlagenumeration value that describes how the method should release the memory pointed to by bufafter the new image is created.
If the call to the IImagingFactory::CreateImageFromBuffermethod fails, the caller still retains ownership of the memory buffer, regardless of what disposalFlagis set to.
- image
-
[out] A pointer to the resulting IImageinterface 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 |