Interface to Alias Pix
files.
Synopsis
#include <AlPixFile.h> class AlPixFile enum Format { kAlias = 1, kSGI, kGIF, kTIFF, kTIFF16, 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& );
Description
This class allows you
to read and write Alias Pix files. Please note that kGIF is unsupported
since this class cannot open GIF files.
AlPixFile::AlPixFile( void
)
Description
Constructs the Pix file object.
AlPixFile::~AlPixFile(
void )
Description
Deletes the Pix file
object.
statusCode AlPixFile::openForWrite(
char *path, int imgWidth, int imgHeight, int numChannels, AlPixFile::Format
fileFormat )
Description
Opens
the Pix file for writing.
Arguments
< path - file to be
opened
< width - resolution
in x direction
< height - resolution
in y direction
< numChannels - 4
for RGBA, 3 for RGB, 1 for A
Return Codes
sSuccess - file successfully
opened for writing
sAlreadyCreated - file
had already been opened
sFailure - file could
not be opened
statusCode AlPixFile::openForRead(
char *path )
Description
Opens
the Pix file for reading.
Arguments
< path - file to be
opened
Return Codes
sSuccess - file successfully
opened for reading
sAlreadyCreated - file
had already been opened
sFailure - file could
not be opened
statusCode AlPixFile::close(
void )
Description
Closes
the Pix file.
Return Codes
sSuccess - file successfully
closed
sInvalidArgument - file
had not been opened
sFailure - file could
not be closed
int AlPixFile::read( AlPixel
*ldata )
Description
Reads a scanline from the Pix file.
’ldata’ must be previously allocated to hold a scanline of AlPixels.
Arguments
> ldata - array of
size ’width’
Return Codes
Returns the number of
pixels read. -1 indicates a failure.
int AlPixFile::write( AlPixel
*ldata )
Description
Writes a scanline to the Pix file.
’ldata’ must contain the scanline.
Arguments
< ldata - array of
size ’width’
Return Codes
Returns the number of
pixels written. -1 indicates a failure.
int AlPixFile::width( void
)
Description
Returns the x resolution of the Pix
file. -1 indicates a failure.
int AlPixFile::height(
void )
Description
Returns the y resolution of the Pix
file. -1 indicates a failure.
int AlPixFile::numChannels(
void )
Description
Returns
the number of used channels in the Pix file. -1 indicates a failure.
statusCode AlPixFile::fileFormat(
AlPixFile::Format &format )
Description
Returns
the format of the pix file.
Arguments
> format - the file
format
Return Codes
sSuccess - the file format
was found
sFailure - the method
failed