Version 2 (modified by 14 years ago) ( diff ) | ,
---|
Table of Contents
CBitmap
CBitmap is a C++ class that is provided to display bitmaps.
Constructors
CBitmap(void); CBitmap(const string& strFilename); CBitmap(const char* pszfilename);
The constructors with a passed filename create a CBitmap object and load the file into memory.
Parameters
- strFilename - filename
- pszFilename - filename
Examples
CBitmap image("/mnt/nand/apps/myapp/myapp.bmp");
string strFile = "/mnt/nand/apps/myapp/myapp.bmp"; CBitmap image(strFile);
CBitmap image;
This constructs the bitmap object without loading any file yet.
Member Functions
LoadBitmp
Opens a specified file.
int LoadBitmap(const string& strFilename); int LoadBitmap(const char* pszFilename);
Parameters
- strFilename - filename
- pszFilename - filename
Return Value
0 successful -2 file cannot be opened -3 bitmap header cannot be read -4 bitmap info cannot be read -5 width is greater than 640, height is greater than 480, or bitmap is not 8 bits per pixel. -6 color palette cannot be read -7 Too many colors in palette
Remarks
Example
CBitmap bitamp; if(bitmap.LoadBitmap("/mnt/nand/apps/myapp/myapp.bmp") != 0) { DisplayText(0, 0, "Error loading bitmap"); }
DeleteBitmap
Deletes memory in RAM allocated to the bitmap. This does not delete the file.
void DeleteBitmap(void);
Parameters
Function does not accept any parameters
Retrun Value
Function does not return any result.
Remarks
Example
CBitmap bitmap("/mnt/nand/apps/myapp/myapp.bmp"); bitmap.Draw(0, 0); SleepSeconds(1); ClearLCD(); bitmap.DeleteBitmap();