Library for interfacing to Nokia 5110 LCD display (as found on the SparkFun website).
Bitmap.h@38:92fad278c2c3, 2017-03-08 (annotated)
- Committer:
- valavanisalex
- Date:
- Wed Mar 08 14:12:42 2017 +0000
- Revision:
- 38:92fad278c2c3
- Child:
- 40:c9262294f2e1
Added Bitmap class to simplify sprite support
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
valavanisalex | 38:92fad278c2c3 | 1 | #ifndef BITMAP_H |
valavanisalex | 38:92fad278c2c3 | 2 | #define BITMAP_H |
valavanisalex | 38:92fad278c2c3 | 3 | |
valavanisalex | 38:92fad278c2c3 | 4 | #include <vector> |
valavanisalex | 38:92fad278c2c3 | 5 | |
valavanisalex | 38:92fad278c2c3 | 6 | /** |
valavanisalex | 38:92fad278c2c3 | 7 | * A monochrome bitmap drawing |
valavanisalex | 38:92fad278c2c3 | 8 | */ |
valavanisalex | 38:92fad278c2c3 | 9 | class Bitmap |
valavanisalex | 38:92fad278c2c3 | 10 | { |
valavanisalex | 38:92fad278c2c3 | 11 | private: |
valavanisalex | 38:92fad278c2c3 | 12 | /** |
valavanisalex | 38:92fad278c2c3 | 13 | * @brief The contents of the drawing, with pixels stored in row-major order |
valavanisalex | 38:92fad278c2c3 | 14 | * @details '1' represents a black pixel; '0' represents white |
valavanisalex | 38:92fad278c2c3 | 15 | */ |
valavanisalex | 38:92fad278c2c3 | 16 | std::vector<int> _contents; |
valavanisalex | 38:92fad278c2c3 | 17 | |
valavanisalex | 38:92fad278c2c3 | 18 | unsigned int _height; ///< The height of the drawing in pixels |
valavanisalex | 38:92fad278c2c3 | 19 | unsigned int _width; ///< The width of the drawing in pixels |
valavanisalex | 38:92fad278c2c3 | 20 | |
valavanisalex | 38:92fad278c2c3 | 21 | public: |
valavanisalex | 38:92fad278c2c3 | 22 | Bitmap(std::vector<int> const &contents, |
valavanisalex | 38:92fad278c2c3 | 23 | unsigned int const height, |
valavanisalex | 38:92fad278c2c3 | 24 | unsigned int const width); |
valavanisalex | 38:92fad278c2c3 | 25 | |
valavanisalex | 38:92fad278c2c3 | 26 | int get_pixel(unsigned int const row, |
valavanisalex | 38:92fad278c2c3 | 27 | unsigned int const column) const; |
valavanisalex | 38:92fad278c2c3 | 28 | }; |
valavanisalex | 38:92fad278c2c3 | 29 | |
valavanisalex | 38:92fad278c2c3 | 30 | #endif // SPRITE_H |