This method lets the application create a decodeded image object from a buffer supplied by the application.
HRESULT CreateImageFromBuffer( const VOID* buf, UINT size, BufferDisposalFlag disposalFlag, IImage** image );
[in] A VOID pointer to the buffer containing the image data.
[in] A UINT value specifying the size, in bytes, of the buffer that buf points to.
[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.
[out] A pointer to the resulting IImage interface pointer.
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.
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.