CRasterImage::LoadFromMemory

int LoadFromMemory( void* MemoryBuffer, int StorageType = GL_RGB );

Parameters

MemoryBufferPointer to the memory the image will be decompressed from. Very first item of the given memory must be a SMemoryImage structure. The ImageType item of the SMemoryImage structure can be one of the following values:
IMAGE_JPEGIndicates that image data referenced by the Data item are stored using the JPEG compression.
IMAGE_GIF Indicates that image data referenced by the Data item are stored using the GIF compression.
IMAGE_BMPIndicates that image data referenced by the Data item are stored using the BMP compression.
IMAGE_TARGA Indicates that image data referenced by the Data item are stored using the TARGA compression.
StorageTypeStorage type used to store the decompressed image in the CrasterImage object. Can be one of the following values:
GL_RGB specifies the GL_RGB format and GL_BYTE type
GL_RGBAspecifies the GL_RGBA format and GL_BYTE type. The alpha values will be initialized to 0xff by the LoadFromMemory method

Return Value

The return value is TRUE if LoadFromMemory method succeeded. The return value is FALSE if LoadFromMemory method failed.

Remarks

Use the LoadFromMemory method to decompress the image from the memory rather from the file. The LoadFromMemory and SaveToMemory methods can be efficiently used to compress CRasterImage object image content into memory, when for example different file storage structure is required to store image data. These methods can be used for example for storing several images into single file or for other purposes.

Note

The LoadFromMemory and SaveToMemory methods have nothing common with Windows API DIB functions such as CreateDIBSection, etc. Their purpose is to compress an image into memory, and decompress and load an image from memory into the CRasterImage object.

See Also

CRasterImage class methods