| 100 | === Draw === |
| 101 | Draws the bitmap on the LCD display |
| 102 | {{{ |
| 103 | void Draw(int x, int y); |
| 104 | }}} |
| 105 | |
| 106 | ==== Parameters ==== |
| 107 | |
| 108 | x - The X coordinate for the left side of the bitmap to be displayed |
| 109 | y - The Y coordinate for the top of the bitmap to be displayed |
| 110 | |
| 111 | ==== Return Value ==== |
| 112 | |
| 113 | Function does not return any result. |
| 114 | |
| 115 | ==== Remarks ==== |
| 116 | |
| 117 | |
| 118 | ==== Example ==== |
| 119 | |
| 120 | {{{ |
| 121 | CBitmap bitmap("/mnt/nand/apps/myapp/myapp.bmp"); |
| 122 | bitmap.Draw(0, 0); |
| 123 | }}} |
| 124 | |
| 125 | |
| 126 | === GetWidth === |
| 127 | Get the width of the bitmap in pixels |
| 128 | {{{ |
| 129 | int GetWidth(void); |
| 130 | }}} |
| 131 | |
| 132 | ==== Parameters ==== |
| 133 | |
| 134 | Function does not accept any parameters. |
| 135 | |
| 136 | ==== Return Value ==== |
| 137 | |
| 138 | Function returns the width of the bitmap in pixels. |
| 139 | |
| 140 | ==== Remarks ==== |
| 141 | |
| 142 | |
| 143 | ==== Example ==== |
| 144 | |
| 145 | {{{ |
| 146 | CBitmap bitmap("/mnt/nand/apps/myapp/myapp.bmp"); |
| 147 | int x = bitmap.GetWidth(); |
| 148 | }}} |
| 149 | |
| 150 | |
| 151 | === GetHeight === |
| 152 | Get the height of the bitmap in pixels |
| 153 | {{{ |
| 154 | int GetHeight(void); |
| 155 | }}} |
| 156 | |
| 157 | ==== Parameters ==== |
| 158 | |
| 159 | Function does not accept any parameters. |
| 160 | |
| 161 | ==== Return Value ==== |
| 162 | |
| 163 | Function returns the height of the bitmap in pixels. |
| 164 | |
| 165 | ==== Remarks ==== |
| 166 | |
| 167 | |
| 168 | ==== Example ==== |
| 169 | |
| 170 | {{{ |
| 171 | CBitmap bitmap("/mnt/nand/apps/myapp/myapp.bmp"); |
| 172 | int y = bitmap.GetHeight(); |
| 173 | }}} |
| 174 | |
| 175 | |
| 176 | === GetColorCnt === |
| 177 | Get the number of colors the bitmap uses |
| 178 | {{{ |
| 179 | int GetColorCnt(void); |
| 180 | }}} |
| 181 | |
| 182 | ==== Parameters ==== |
| 183 | |
| 184 | Function does not accept any parameters. |
| 185 | |
| 186 | ==== Return Value ==== |
| 187 | |
| 188 | Function returns the number of colors used by the bitmap. |
| 189 | |
| 190 | ==== Remarks ==== |
| 191 | |
| 192 | |
| 193 | ==== Example ==== |
| 194 | |
| 195 | {{{ |
| 196 | CBitmap bitmap("/mnt/nand/apps/myapp/myapp.bmp"); |
| 197 | int n = bitmap.GetColorCnt(); |
| 198 | }}} |
| 199 | |
| 200 | |
| 201 | === GetColorsAdded === |
| 202 | Get the numbers of colors added to the 825 global palette when the bitmap was loaded |
| 203 | {{{ |
| 204 | int GetColorsAdded(void); |
| 205 | }}} |
| 206 | |
| 207 | ==== Parameters ==== |
| 208 | |
| 209 | Function does not accept any parameters. |
| 210 | |
| 211 | ==== Return Value ==== |
| 212 | |
| 213 | Function returns the number of colors added to the 825 global palette when the bitmap was loaded. |
| 214 | |
| 215 | ==== Remarks ==== |
| 216 | |
| 217 | |
| 218 | ==== Example ==== |
| 219 | |
| 220 | {{{ |
| 221 | CBitmap bitmap("/mnt/nand/apps/myapp/myapp.bmp"); |
| 222 | int n = bitmap.GetColorsAdded(); |
| 223 | }}} |
| 224 | |
| 225 | |
| 226 | === GetError === |
| 227 | Get the error code |
| 228 | {{{ |
| 229 | int GetError(void); |
| 230 | }}} |
| 231 | |
| 232 | ==== Parameters ==== |
| 233 | |
| 234 | Function does not accept any parameters. |
| 235 | |
| 236 | ==== Return Value ==== |
| 237 | |
| 238 | Function returns the current error code. |
| 239 | |
| 240 | ==== Remarks ==== |
| 241 | |
| 242 | |
| 243 | ==== Example ==== |
| 244 | |
| 245 | {{{ |
| 246 | CBitmap bitmap("/mnt/nand/apps/myapp/myapp.bmp"); |
| 247 | int err = bitmap.GetError(); |
| 248 | if(err != 0) |
| 249 | { |
| 250 | DisplayText(0, 0, "Error loading bitmap"); |
| 251 | } |
| 252 | }}} |
| 253 | |
| 254 | |
| 255 | === ReclaimColors === |
| 256 | Reclaim custom colors added by loading bitmaps |
| 257 | {{{ |
| 258 | static void ReclaimColors(void); |
| 259 | }}} |
| 260 | |
| 261 | ==== Parameters ==== |
| 262 | |
| 263 | Function does not accept any parameters. |
| 264 | |
| 265 | ==== Return Value ==== |
| 266 | |
| 267 | Function does not return any value. |
| 268 | |
| 269 | ==== Remarks ==== |
| 270 | |
| 271 | In 8 bits per pixel mode all bitmaps and text or other graphics on the display at any given time must share a palette of 256 colors. ReclaimColors releases the colors that were added by displaying bitmaps. |
| 272 | |
| 273 | ==== Example ==== |
| 274 | |
| 275 | {{{ |
| 276 | CBitmap img1("/mnt/nand/apps/myapp/img1.bmp"); |
| 277 | CBitmap img2("/mnt/nand/apps/myapp/img2.bmp"); |
| 278 | img1.Draw(0, 0); |
| 279 | img2.Draw(320, 0); |
| 280 | |
| 281 | SleepSeconds(5); |
| 282 | ClearLCD(); |
| 283 | img1.DeleteBitmap(); |
| 284 | img2.DeleteBitmap(); |
| 285 | |
| 286 | CBitmap::ReclaimColors(); |
| 287 | |
| 288 | CBitmap img3("/mnt/nand/apps/myapp/img3.bmp"); |
| 289 | CBitmap img4("/mnt/nand/apps/myapp/img4.bmp"); |
| 290 | img3.Draw(0, 0); |
| 291 | img4.Draw(320, 0); |
| 292 | }}} |