C4 Engine
C4 Engine API Documentation


Defined in:  C4Plugins.h
Exports an image to a file.

virtual EngineResult ExportImageFile(const char *name, const Color4U *image, const Integer2D& size, uint32 flags = 0) = 0;

name The file name of the image, relative to the engine executable.
image A pointer to a buffer in which the image is stored.
size The dimensions of the image.
flags Flags pertaining to the export process.
The ExportImageFile function exports an image to the file specified by the name paramater. If the function succeeds, then the return value is kEngineOkay. If an error occurred, then the result code corresponding to the error is returned. The image parameter specifies the buffer containing the image data, and the size parameter specifies the horizontal and vertical dimensions of the image. Exactly 4wh bytes are read from the image buffer, where w and h are the width and height of the image. The image data must be stored in RGBA format with 8 bits per channel. The flags parameter specifies various options that control the export process, and it can be a combination (through logical OR) of the following constants.
kImageExportAlpha Include an alpha channel in the exported image.
kImageExportUncompressed Do not compress the exported image, if possible.
kImageExportBGRA The image data to be exported is stored in BGRA order.
The ExportImageFile function must be overridden by subclasses of the ImageExportPlugin class.