MXABmpIO Class Reference

This class Handles the Reading of Windows Bitmap files (.bmp). More...

Collaboration diagram for MXABmpIO:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MXABmpIO ()
virtual ~MXABmpIO ()
int32 getHeight ()
 Returns height of image.
int32 getWidth ()
 returns width of image
int32 getNumberOfChannels ()
 Returns the number of color channels in the Image.
LOAD_TEXTUREBMP_RESULT loadBMPData (const char *fName, bool readAsGrayScale=false)
 Loads the bmp from file into memory.
void convertToGrayscale ()
 Converts the image to grayscale.
bool isGrayscaleImage ()
 Is the image a grayscale image.
UCharArray getImageData (bool copy=true)
 Either makes a new copy of the image data or returns a reference to the actual memory.
int32 copyImageData (uint8 *destinationBuffer)
 Copies the image data. The destination buffer MUST already be preallocated to hold all the data.

Private Member Functions

int32 read32BitValue ()
 Reads a 4 byte integer from the file.
int16 read16BitValue ()
 Reads a 2 byte integer from the file.
uint8 read8BitValue ()
 Reads a 1 byte integer from the file.
LOAD_TEXTUREBMP_RESULT readFileHeader ()
 Reads the file header from the bmp file.
LOAD_TEXTUREBMP_RESULT readInfoHeader ()
 Reads the info header from the bmp file.
LOAD_TEXTUREBMP_RESULT readPalette ()
 Reads the color palette from the bmp file.
LOAD_TEXTUREBMP_RESULT readBitmapData ()
 Reads the bitmap data from the bmp file.
LOAD_TEXTUREBMP_RESULT readBitmapData1Bit ()
 Reads 1 bit encoded bitmap data from the bmp file.
LOAD_TEXTUREBMP_RESULT readBitmapData4Bit ()
 Reads 4 bit encoded bitmap data from the bmp file.
LOAD_TEXTUREBMP_RESULT readBitmapData8Bit ()
 Reads 8 bit encoded bitmap data from the bmp file.
LOAD_TEXTUREBMP_RESULT readBitmapData24Bit ()
 Reads 24 bit encoded bitmap data from the bmp file.
bool handleEscapeCode (int secondByte, int *x, int *y, LOAD_TEXTUREBMP_RESULT *res)
 Parser for escape codes.
void flipBitmap ()
 Flips the bitmap image so the (0,0) pixel is in the upper left.
 MXABmpIO (const MXABmpIO &)
void operator= (const MXABmpIO &)

Private Attributes

UCharArray bitmapDataVec
int32 width
int32 height
int32 numChannels
bool isGrayscale
bool _imageFlipped
bool _imageConvertedToGrayScale
bool _convertToGrayScale
std::streamsize bytesRead
MXABMPFileHeader fileHeader
MXABMPDIBHeader dibHeader
Reader64Ptr _reader64Ptr
uint8 palette [3][256]

Detailed Description

This class Handles the Reading of Windows Bitmap files (.bmp).

Author:
Herb Mullens
Date:
Oct 2007
Version:
Revision
1.2


Constructor & Destructor Documentation

MXABmpIO::MXABmpIO (  ) 

MXABmpIO::~MXABmpIO (  )  [virtual]

MXABmpIO::MXABmpIO ( const MXABmpIO  )  [private]


Member Function Documentation

int32 MXABmpIO::getHeight (  ) 

Returns height of image.

int32 MXABmpIO::getWidth (  ) 

returns width of image

int32 MXABmpIO::getNumberOfChannels (  ) 

Returns the number of color channels in the Image.

LOAD_TEXTUREBMP_RESULT MXABmpIO::loadBMPData ( const char *  fName,
bool  readAsGrayScale = false 
)

Loads the bmp from file into memory.

Parameters:
fName The file name of the image to load
readAsGrayScale Read the file as a grayscale image
Returns:
Error code.

void MXABmpIO::convertToGrayscale (  ) 

Converts the image to grayscale.

bool MXABmpIO::isGrayscaleImage (  ) 

Is the image a grayscale image.

UCharArray MXABmpIO::getImageData ( bool  copy = true  ) 

Either makes a new copy of the image data or returns a reference to the actual memory.

Parameters:
copy If true, make a copy of the data instead of returning a reference.

int32 MXABmpIO::copyImageData ( uint8 *  destinationBuffer  ) 

Copies the image data. The destination buffer MUST already be preallocated to hold all the data.

Returns:
error condition if there was an error.

int32 MXABmpIO::read32BitValue (  )  [private]

Reads a 4 byte integer from the file.

int16 MXABmpIO::read16BitValue (  )  [private]

Reads a 2 byte integer from the file.

uint8 MXABmpIO::read8BitValue (  )  [private]

Reads a 1 byte integer from the file.

LOAD_TEXTUREBMP_RESULT MXABmpIO::readFileHeader (  )  [private]

Reads the file header from the bmp file.

Returns:
LOAD_TEXTUREBMP_RESULT

LOAD_TEXTUREBMP_RESULT MXABmpIO::readInfoHeader (  )  [private]

Reads the info header from the bmp file.

Returns:
LOAD_TEXTUREBMP_RESULT

LOAD_TEXTUREBMP_RESULT MXABmpIO::readPalette (  )  [private]

Reads the color palette from the bmp file.

Returns:
LOAD_TEXTUREBMP_RESULT

LOAD_TEXTUREBMP_RESULT MXABmpIO::readBitmapData (  )  [private]

Reads the bitmap data from the bmp file.

Returns:
LOAD_TEXTUREBMP_RESULT

LOAD_TEXTUREBMP_RESULT MXABmpIO::readBitmapData1Bit (  )  [private]

Reads 1 bit encoded bitmap data from the bmp file.

Returns:
LOAD_TEXTUREBMP_RESULT

LOAD_TEXTUREBMP_RESULT MXABmpIO::readBitmapData4Bit (  )  [private]

Reads 4 bit encoded bitmap data from the bmp file.

Returns:
LOAD_TEXTUREBMP_RESULT

LOAD_TEXTUREBMP_RESULT MXABmpIO::readBitmapData8Bit (  )  [private]

Reads 8 bit encoded bitmap data from the bmp file.

Returns:
LOAD_TEXTUREBMP_RESULT

LOAD_TEXTUREBMP_RESULT MXABmpIO::readBitmapData24Bit (  )  [private]

Reads 24 bit encoded bitmap data from the bmp file.

Returns:
LOAD_TEXTUREBMP_RESULT

bool MXABmpIO::handleEscapeCode ( int  secondByte,
int *  x,
int *  y,
LOAD_TEXTUREBMP_RESULT res 
) [private]

Parser for escape codes.

Parameters:
secondByte 
x 
y 
res 
Returns:

void MXABmpIO::flipBitmap (  )  [private]

Flips the bitmap image so the (0,0) pixel is in the upper left.

void MXABmpIO::operator= ( const MXABmpIO  )  [private]


Member Data Documentation

UCharArray MXABmpIO::bitmapDataVec [private]

int32 MXABmpIO::width [private]

int32 MXABmpIO::height [private]

int32 MXABmpIO::numChannels [private]

bool MXABmpIO::isGrayscale [private]

bool MXABmpIO::_imageFlipped [private]

bool MXABmpIO::_imageConvertedToGrayScale [private]

bool MXABmpIO::_convertToGrayScale [private]

std::streamsize MXABmpIO::bytesRead [private]

MXABMPFileHeader MXABmpIO::fileHeader [private]

MXABMPDIBHeader MXABmpIO::dibHeader [private]

Reader64Ptr MXABmpIO::_reader64Ptr [private]

uint8 MXABmpIO::palette[3][256] [private]


The documentation for this class was generated from the following files:
Generated on Tue Nov 17 18:43:14 2009 for MXADataModel by  doxygen 1.5.2