Final tidy of code following installation of new sensor, more comments added prior to submission
Dependencies: mbed
Bitmap Class Reference
A black & white bitmap that can be rendered on an N5110 screen. More...
#include <Bitmap.h>
Public Member Functions | |
| int | get_pixel (unsigned int const row, unsigned int const column) const |
| void | print () const |
| Prints the contents of the bitmap to the terminal. | |
| void | render (N5110 &lcd, unsigned int const x0, unsigned int const y0) const |
| Renders the contents of the bitmap onto an N5110 screen. | |
Detailed Description
A black & white bitmap that can be rendered on an N5110 screen.
// First declare the pixel map data using '1' for black, // or '0' for white pixels static int sprite_data[] = { 0,0,1,0,0, 0,1,1,1,0, 0,0,1,0,0, 0,1,1,1,0, 1,1,1,1,1, 1,1,1,1,1, 1,1,0,1,1, 1,1,0,1,1 }; // Instantiate the Bitmap object using the data above Bitmap sprite(sprite_data, 8, 5); // Specify rows and columns in sprite // We can render the bitmap wherever we want on the screen sprite.render(lcd, 20, 6); // x and y locations for rendering sprite.render(lcd, 30, 10); // We can also print its values to the terminal sprite.print();
Definition at line 52 of file Bitmap.h.
Member Function Documentation
| int get_pixel | ( | unsigned int const | row, |
| unsigned int const | column | ||
| ) | const |
- Returns:
- the value of the pixel at the given position
Definition at line 42 of file Bitmap.cpp.
| void print | ( | ) | const |
Prints the contents of the bitmap to the terminal.
Definition at line 60 of file Bitmap.cpp.
| void render | ( | N5110 & | lcd, |
| unsigned int const | x0, | ||
| unsigned int const | y0 | ||
| ) | const |
Renders the contents of the bitmap onto an N5110 screen.
- Parameters:
-
[in] lcd The screen to use for rendering [in] x0 The horizontal position in pixels at which to render the bitmap [in] y0 The vertical position in pixels at which to render the bitmap
Note that x0, y0 gives the location of the top-left of the bitmap on the screen. This function only updates the buffer on the screen. You still need to refresh the screen in order to actually see the bitmap.
Definition at line 88 of file Bitmap.cpp.
Generated on Thu Jul 28 2022 14:09:35 by
1.7.2