| 4 | |
| 5 | CBitmap is a C++ class that is provided to display bitmaps. |
| 6 | |
| 7 | == Constructors == |
| 8 | |
| 9 | {{{ |
| 10 | CBitmap(void); |
| 11 | CBitmap(const string& strFilename); |
| 12 | CBitmap(const char* pszfilename); |
| 13 | }}} |
| 14 | The constructors with a passed filename create a CBitmap object and load the file into memory. |
| 15 | |
| 16 | ==== Parameters ==== |
| 17 | * strFilename - filename |
| 18 | * pszFilename - filename |
| 19 | |
| 20 | ==== Examples ==== |
| 21 | |
| 22 | {{{ |
| 23 | CBitmap image("/mnt/nand/apps/myapp/myapp.bmp"); |
| 24 | }}} |
| 25 | |
| 26 | {{{ |
| 27 | string strFile = "/mnt/nand/apps/myapp/myapp.bmp"; |
| 28 | CBitmap image(strFile); |
| 29 | }}} |
| 30 | |
| 31 | {{{ |
| 32 | CBitmap image; |
| 33 | }}} |
| 34 | This constructs the bitmap object without loading any file yet. |
| 35 | |
| 36 | == Member Functions == |
| 37 | |
| 38 | === LoadBitmp === |
| 39 | Opens a specified file. |
| 40 | |
| 41 | {{{ |
| 42 | int LoadBitmap(const string& strFilename); |
| 43 | int LoadBitmap(const char* pszFilename); |
| 44 | }}} |
| 45 | |
| 46 | ==== Parameters ==== |
| 47 | * strFilename - filename |
| 48 | * pszFilename - filename |
| 49 | |
| 50 | ==== Return Value ==== |
| 51 | |
| 52 | 0 successful |
| 53 | -2 file cannot be opened |
| 54 | -3 bitmap header cannot be read |
| 55 | -4 bitmap info cannot be read |
| 56 | -5 width is greater than 640, height is greater than 480, or bitmap is not 8 bits per pixel. |
| 57 | -6 color palette cannot be read |
| 58 | -7 Too many colors in palette |
| 59 | |
| 60 | ==== Remarks ==== |
| 61 | |
| 62 | ==== Example ==== |
| 63 | |
| 64 | {{{ |
| 65 | CBitmap bitamp; |
| 66 | if(bitmap.LoadBitmap("/mnt/nand/apps/myapp/myapp.bmp") != 0) |
| 67 | { |
| 68 | DisplayText(0, 0, "Error loading bitmap"); |
| 69 | } |
| 70 | |
| 71 | }}} |
| 72 | |
| 73 | === DeleteBitmap === |
| 74 | Deletes memory in RAM allocated to the bitmap. This does not delete the file. |
| 75 | {{{ |
| 76 | void DeleteBitmap(void); |
| 77 | }}} |
| 78 | |
| 79 | ==== Parameters ==== |
| 80 | |
| 81 | Function does not accept any parameters |
| 82 | |
| 83 | ==== Retrun Value ==== |
| 84 | |
| 85 | Function does not return any result. |
| 86 | |
| 87 | ==== Remarks ==== |
| 88 | |
| 89 | |
| 90 | ==== Example ==== |
| 91 | |
| 92 | {{{ |
| 93 | CBitmap bitmap("/mnt/nand/apps/myapp/myapp.bmp"); |
| 94 | bitmap.Draw(0, 0); |
| 95 | SleepSeconds(1); |
| 96 | ClearLCD(); |
| 97 | bitmap.DeleteBitmap(); |
| 98 | }}} |
| 99 | |