#include <AlPixFile.h>
class AlPixFile
enum Format
{ kAlias = 1, kSGI, kGIF, kTIFF, kTIFF16, KFIT, kOMF, kTIM, kRLA, kFIDO, kHARRY };
AlPixFile();
virtual ~AlPixFile();
statusCode openForRead( char *path );
statusCode openForWrite( char *path, int width, int height, int numChannels, Format fileFormat = kAlias );
statusCode close();
int read( AlPixel *ldata );
int write( AlPixel *ldata );
int width();
int height();
int numChannels();
statusCode fileFormat( Format& );
This class allows you to read and write Alias Pix files. Please note that kGIF is unsupported since this class cannot open Gif files.
Constructs the Pix file object.
Opens the Pix file for writing.
< width - resolution in x direction
< height - resolution in y direction
< numChannels - 4 for RGBA, 3 for RGB, 1 for A
sSuccess - file succesfully opened for writing
sAlreadyCreated - file had already been opened
sFailure - file could not be opened
Opens the Pix file for reading.
sSuccess - file succesfully opened for reading
sAlreadyCreated - file had already been opened
sFailure - file could not be opened
sSuccess - file succesfully closed
sInvalidArgument - file had not been opened
sFailure - file could not be closed
Reads a scanline from the Pix file. 'ldata' must be previously allocated to hold a scanline of AlPixels.
> ldata - array of size 'width'
Returns the number of pixels read. -1 indicates a failure.
Writes a scanline to the Pix file. 'ldata' must contain the scanline.
< ldata - array of size 'width'
Returns the number of pixels written. -1 indicates a failure.
Returns the x resolution of the Pix file. -1 indicates a failure.
Returns the y resolution of the Pix file. -1 indicates a failure.
Returns the number of used channels in the Pix file. -1 indicates a failure.
Returns the format of the pix file.
sSuccess - the file format was found