SSD1306 I2C Display Driver  1.1.0
This library is developed to control SSD1306 I2C OLED Display
nano_gfx.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2016-2017 Alexey Dynda
3 
4  This file is part of SSD1306 library.
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
24 #ifndef _NANO_GFX_H_
25 #define _NANO_GFX_H_
26 
27 #include "nano_gfx_types.h"
28 
29 #include "font6x8.h"
30 
35 {
36 public:
47  NanoCanvas(uint8_t w, uint8_t h, uint8_t *bytes)
48  {
49  m_w = w;
50  m_h = h;
51  m_p = 3;
52  m_inverseByte = 0;
53  while (w >> (m_p+1)) { m_p++; };
54  m_bytes = bytes;
55  clear();
56  };
57 
63  inline void drawPixel(uint8_t x, uint8_t y) __attribute__ ((deprecated)) { putPixel(x,y); };
64 
70  void putPixel(uint8_t x, uint8_t y);
71 
79  void drawRect(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2);
80 
87  void drawHLine(uint8_t x1, uint8_t y1, uint8_t x2);
88 
95  void drawVLine(uint8_t x1, uint8_t y1, uint8_t y2);
96 
105  void fillRect(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t templ);
106 
110  void clear();
111 
119  inline void char_f6x8(uint8_t x, uint8_t y, const char ch[], EFontStyle style = STYLE_NORMAL)
120  __attribute__ ((deprecated))
121  { charF6x8(x,y,ch,style); };
122 
130  void charF6x8(uint8_t x, uint8_t y, const char ch[], EFontStyle style = STYLE_NORMAL);
131 
136  void drawSpritePgm(uint8_t x, uint8_t y, const uint8_t sprite[]);
137 
142  void drawSprite(uint8_t x, uint8_t y, const uint8_t sprite[]);
143 
148  void drawSprite(SPRITE *sprite);
149 
153  inline uint8_t width() { return m_w; };
154 
158  inline uint8_t height() { return m_h; };
159 
163  inline uint8_t *buffer() { return m_bytes; };
164 
169  void invert();
170 
174  void flipH();
175 
181  void blt(uint8_t x, uint8_t y);
182 
183 private:
184  uint8_t m_w;
185  uint8_t m_p;
186  uint8_t m_h;
187  uint8_t m_inverseByte;
188  uint8_t *m_bytes;
189 };
190 
191 #endif
192 
void charF6x8(uint8_t x, uint8_t y, const char ch[], EFontStyle style=STYLE_NORMAL)
Definition: nano_gfx.cpp:114
void fillRect(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t templ)
Definition: nano_gfx.cpp:70
void clear()
Definition: nano_gfx.cpp:105
uint8_t width()
Definition: nano_gfx.h:153
void drawSpritePgm(uint8_t x, uint8_t y, const uint8_t sprite[])
Definition: nano_gfx.cpp:155
void drawSprite(uint8_t x, uint8_t y, const uint8_t sprite[])
Definition: nano_gfx.cpp:171
void invert()
Definition: nano_gfx.cpp:205
void flipH()
Definition: nano_gfx.cpp:211
void drawVLine(uint8_t x1, uint8_t y1, uint8_t y2)
Definition: nano_gfx.cpp:51
void drawRect(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2)
Definition: nano_gfx.cpp:61
NanoCanvas(uint8_t w, uint8_t h, uint8_t *bytes)
Definition: nano_gfx.h:47
uint8_t height()
Definition: nano_gfx.h:158
void blt(uint8_t x, uint8_t y)
Definition: nano_gfx.cpp:200
void char_f6x8(uint8_t x, uint8_t y, const char ch[], EFontStyle style=STYLE_NORMAL) __attribute__((deprecated))
Definition: nano_gfx.h:119
void drawPixel(uint8_t x, uint8_t y) __attribute__((deprecated))
Definition: nano_gfx.h:63
void putPixel(uint8_t x, uint8_t y)
Definition: nano_gfx.cpp:28
EFontStyle
void drawHLine(uint8_t x1, uint8_t y1, uint8_t x2)
Definition: nano_gfx.cpp:41
uint8_t * buffer()
Definition: nano_gfx.h:163