Skip to content
teq85 edited this page May 20, 2013 · 1 revision

Bitmap Class (cBitmap)

Loads and stores a Bitmap file. Data is stored in struct Pixel (4 Bytes).

Constructors:

cBitmap()

Construct an empty bitmap object.

cBitmap( char * filename )

Construct a bitmap object and load the contents from filename.

Functions:

int loadBitmap( char * filename )

Load contents from filename. Returns -1 on failure.

int saveBitmap( char * filename )

Write contents to file specified by filename. Returns -1 on failure.

int getPixel( int x, int y, Pixel & p )

Saves the pixel specified by x and y in parameter p. Returns -1 on failure.

int setPixel( int x, int y, Pixel p )

Updates the pixel specified by x and y using p. Returns -1 on failure.

void getBitmap( unsigned char * buffer, int maxsize )

Copy the bitmap from internal storage to parameter buffer. maxsizes specifies the size of buffer.

void setBitmap( unsigned char * bmp, int w, int h, int bpp )

Update the internal storage using data in parameter bmp. w specifies the width of the new image, h the height, bpp the number of bytes per pixel.

void getRangeOfBitmap( unsigned char * buffer, int maxsize, int min_x, int max_x, int min_y, int max_y )

Copy a quadratic area delimited by min_x, max_x, min_y, max_y from bitmap into parameter buffer. If the limits are out of bounds, 0 and width/height respectively are used as limits.

int getWidth()

Returns the width of image

int getHeight()

Returns the height of image

int getBPP()

Returns the number of bytes per pixel