SSD1306 OLED display driver  1.3.2
This library is developed to control SSD1306 i2c/spi 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 #include "font6x8.h"
29 
34 {
35 public:
46  NanoCanvas(uint8_t w, uint8_t h, uint8_t *bytes)
47  {
48  m_w = w;
49  m_h = h;
50  m_p = 3;
51  m_invertByte = 0;
52  while (w >> (m_p+1)) { m_p++; };
53  m_bytes = bytes;
54  clear();
55  };
56 
62  inline void drawPixel(uint8_t x, uint8_t y) __attribute__ ((deprecated)) { putPixel(x,y); };
63 
69  void putPixel(uint8_t x, uint8_t y);
70 
78  void drawRect(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2);
79 
86  void drawHLine(uint8_t x1, uint8_t y1, uint8_t x2);
87 
94  void drawVLine(uint8_t x1, uint8_t y1, uint8_t y2);
95 
104  void fillRect(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t templ);
105 
109  void clear();
110 
118  inline void char_f6x8(uint8_t x, uint8_t y, const char ch[], EFontStyle style = STYLE_NORMAL)
119  __attribute__ ((deprecated))
120  { charF6x8(x,y,ch,style); };
121 
129  void charF6x8(uint8_t x, uint8_t y, const char ch[], EFontStyle style = STYLE_NORMAL);
130 
135  void drawSpritePgm(uint8_t x, uint8_t y, const uint8_t sprite[]);
136 
141  void drawSprite(uint8_t x, uint8_t y, const uint8_t sprite[]);
142 
147  void drawSprite(SPRITE *sprite);
148 
152  inline uint8_t width() const { return m_w; };
153 
157  inline uint8_t height() const { return m_h; };
158 
162  inline uint8_t *buffer() const { return m_bytes; };
163 
168  void invert();
169 
173  void flipH();
174 
180  void blt(uint8_t x, uint8_t y);
181 
182 private:
183  uint8_t m_w;
184  uint8_t m_p;
185  uint8_t m_h;
186  uint8_t m_invertByte;
187  uint8_t *m_bytes;
188 };
189 
190 #endif
191 
void charF6x8(uint8_t x, uint8_t y, const char ch[], EFontStyle style=STYLE_NORMAL)
Definition: nano_gfx.cpp:114
uint8_t * buffer() const
Definition: nano_gfx.h:162
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
void drawSpritePgm(uint8_t x, uint8_t y, const uint8_t sprite[])
Definition: nano_gfx.cpp:161
void drawSprite(uint8_t x, uint8_t y, const uint8_t sprite[])
Definition: nano_gfx.cpp:177
void invert()
Definition: nano_gfx.cpp:211
void flipH()
Definition: nano_gfx.cpp:217
uint8_t width() const
Definition: nano_gfx.h:152
uint8_t height() const
Definition: nano_gfx.h:157
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:46
void blt(uint8_t x, uint8_t y)
Definition: nano_gfx.cpp:206
void char_f6x8(uint8_t x, uint8_t y, const char ch[], EFontStyle style=STYLE_NORMAL) __attribute__((deprecated))
Definition: nano_gfx.h:118
void drawPixel(uint8_t x, uint8_t y) __attribute__((deprecated))
Definition: nano_gfx.h:62
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