CRasterImage::SaveToMemory

int SaveToMemory( SMemoryImage** MemoryBuffer, int ImageType );

Parameters

MemoryBuffer Pointer to the SMemoryImage structure pointer. The SaveToMemory method stores the pointer to output memory location to that SMemoryImage structure pointer.
ImageType Can be one of the following values:
IMAGE_JPEG The JPEG compression will be used
IMAGE_GIF The GIF compression will be used
IMAGE_BMP The BMP compression will be used
IMAGE_TARGA The TARGA compression will be used

Return Value

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

Remarks

The SaveToMemory method compress current objectís image to a memory. The memory storage is allocated by the SaveToMemory method and pointer to it copied to location given by MemoryBuffer parameter. Use C++ delete operator to release it when it is no longer needed. When SaveToMemory method fails, the location given by MemoryBuffer pointer does not contain the allocated memory itís value is undefined.

The LoadFromMemory and SaveToMemory methods can be efficiently used when for example different file storage structure is required to store image data (for example for storing several images into single file), or for other purposes.

Note

The LoadFromMemory and SaveTo Memory 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