Adafruit GFX Library
Adafruit_GFX.h
1 #ifndef _ADAFRUIT_GFX_H
2 #define _ADAFRUIT_GFX_H
3 
4 #if ARDUINO >= 100
5 #include "Arduino.h"
6 #include "Print.h"
7 #else
8 #include "WProgram.h"
9 #endif
10 #include "gfxfont.h"
11 
12 #include <Adafruit_I2CDevice.h>
13 #include <Adafruit_SPIDevice.h>
14 
18 class Adafruit_GFX : public Print {
19 
20 public:
21  Adafruit_GFX(int16_t w, int16_t h); // Constructor
22 #if !defined(__AVR__)
23  // Virtual so deleting a canvas or display through an Adafruit_GFX pointer
24  // frees it. Skipped on AVR, where it links malloc/free into every sketch.
25  virtual ~Adafruit_GFX() {}
26 #endif
27 
28  /**********************************************************************/
36  /**********************************************************************/
37  virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0;
38 
39  // TRANSACTION API / CORE DRAW API
40  // These MAY be overridden by the subclass to provide device-specific
41  // optimized code. Otherwise 'generic' versions are used.
42  virtual void startWrite(void);
43  virtual void writePixel(int16_t x, int16_t y, uint16_t color);
44  virtual void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h,
45  uint16_t color);
46  virtual void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
47  virtual void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
48  virtual void writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
49  uint16_t color);
50  virtual void endWrite(void);
51 
52  // CONTROL API
53  // These MAY be overridden by the subclass to provide device-specific
54  // optimized code. Otherwise 'generic' versions are used.
55  virtual void setRotation(uint8_t r);
56  virtual void invertDisplay(bool i);
57 
58  // BASIC DRAW API
59  // These MAY be overridden by the subclass to provide device-specific
60  // optimized code. Otherwise 'generic' versions are used.
61 
62  // It's good to implement those, even if using transaction API
63  virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
64  virtual void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
65  virtual void fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
66  uint16_t color);
67  virtual void fillScreen(uint16_t color);
68  // Optional and probably not necessary to change
69  virtual void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
70  uint16_t color);
71  virtual void drawRect(int16_t x, int16_t y, int16_t w, int16_t h,
72  uint16_t color);
73 
74  // These exist only with Adafruit_GFX (no subclass overrides)
75  void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
76  void drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername,
77  uint16_t color);
78  void fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
79  void fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername,
80  int16_t delta, uint16_t color);
81  void drawEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh,
82  uint16_t color);
83  void fillEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh,
84  uint16_t color);
85  void drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2,
86  int16_t y2, uint16_t color);
87  void fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2,
88  int16_t y2, uint16_t color);
89  void drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
90  int16_t radius, uint16_t color);
91  void fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
92  int16_t radius, uint16_t color);
93  void drawRotatedRect(int16_t cenX, int16_t cenY, int16_t w, int16_t h,
94  int16_t angleDeg, uint16_t color);
95  void fillRotatedRect(int16_t cenX, int16_t cenY, int16_t w, int16_t h,
96  int16_t angleDeg, uint16_t color);
97  void rotatePoint(int16_t &x0, int16_t &y0, int16_t angleDeg);
98  void drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w,
99  int16_t h, uint16_t color);
100  void drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w,
101  int16_t h, uint16_t color, uint16_t bg);
102  void drawBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h,
103  uint16_t color);
104  void drawBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h,
105  uint16_t color, uint16_t bg);
106  void drawXBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w,
107  int16_t h, uint16_t color);
108  void drawXBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w,
109  int16_t h, uint16_t color, uint16_t bg);
110  void drawGrayscaleBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
111  int16_t w, int16_t h);
112  void drawGrayscaleBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w,
113  int16_t h);
114  void drawGrayscaleBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
115  const uint8_t mask[], int16_t w, int16_t h);
116  void drawGrayscaleBitmap(int16_t x, int16_t y, uint8_t *bitmap, uint8_t *mask,
117  int16_t w, int16_t h);
118  void drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[], int16_t w,
119  int16_t h);
120  void drawRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w,
121  int16_t h);
122  void drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[],
123  const uint8_t mask[], int16_t w, int16_t h);
124  void drawRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, uint8_t *mask,
125  int16_t w, int16_t h);
126  void drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color,
127  uint16_t bg, uint8_t size);
128  void drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color,
129  uint16_t bg, uint8_t size_x, uint8_t size_y);
130  void getTextBounds(const char *string, int16_t x, int16_t y, int16_t *x1,
131  int16_t *y1, uint16_t *w, uint16_t *h);
132  void getTextBounds(const __FlashStringHelper *s, int16_t x, int16_t y,
133  int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h);
134  void getTextBounds(const String &str, int16_t x, int16_t y, int16_t *x1,
135  int16_t *y1, uint16_t *w, uint16_t *h);
136  void setTextSize(uint8_t s);
137  void setTextSize(uint8_t sx, uint8_t sy);
138  void setFont(const GFXfont *f = NULL);
139 
140  /**********************************************************************/
146  /**********************************************************************/
147  void setCursor(int16_t x, int16_t y) {
148  cursor_x = x;
149  cursor_y = y;
150  }
151 
152  /**********************************************************************/
159  /**********************************************************************/
160  void setTextColor(uint16_t c) { textcolor = textbgcolor = c; }
161 
162  /**********************************************************************/
168  /**********************************************************************/
169  void setTextColor(uint16_t c, uint16_t bg) {
170  textcolor = c;
171  textbgcolor = bg;
172  }
173 
174  /**********************************************************************/
180  /**********************************************************************/
181  void setTextWrap(bool w) { wrap = w; }
182 
183  /**********************************************************************/
196  /**********************************************************************/
197  void cp437(bool x = true) { _cp437 = x; }
198 
199  using Print::write;
200 #if ARDUINO >= 100
201  virtual size_t write(uint8_t);
202 #else
203  virtual void write(uint8_t);
204 #endif
205 
206  /************************************************************************/
211  /************************************************************************/
212  int16_t width(void) const { return _width; };
213 
214  /************************************************************************/
219  /************************************************************************/
220  int16_t height(void) const { return _height; }
221 
222  /************************************************************************/
227  /************************************************************************/
228  uint8_t getRotation(void) const { return rotation; }
229 
230  // get current cursor position (get rotation safe maximum values,
231  // using: width() for x, height() for y)
232  /************************************************************************/
237  /************************************************************************/
238  int16_t getCursorX(void) const { return cursor_x; }
239 
240  /************************************************************************/
245  /************************************************************************/
246  int16_t getCursorY(void) const { return cursor_y; };
247 
248 protected:
249  void charBounds(unsigned char c, int16_t *x, int16_t *y, int16_t *minx,
250  int16_t *miny, int16_t *maxx, int16_t *maxy);
251  int16_t WIDTH;
252  int16_t HEIGHT;
253  int16_t _width;
254  int16_t _height;
255  int16_t cursor_x;
256  int16_t cursor_y;
257  uint16_t textcolor;
258  uint16_t textbgcolor;
259  uint8_t textsize_x;
260  uint8_t textsize_y;
261  uint8_t rotation;
262  bool wrap;
263  bool _cp437;
265 };
266 
269 
270 public:
271  Adafruit_GFX_Button(void);
272  // "Classic" initButton() uses center & size
273  void initButton(Adafruit_GFX *gfx, int16_t x, int16_t y, uint16_t w,
274  uint16_t h, uint16_t outline, uint16_t fill,
275  uint16_t textcolor, const char *label, uint8_t textsize);
276  void initButton(Adafruit_GFX *gfx, int16_t x, int16_t y, uint16_t w,
277  uint16_t h, uint16_t outline, uint16_t fill,
278  uint16_t textcolor, const char *label, uint8_t textsize_x,
279  uint8_t textsize_y);
280  // New/alt initButton() uses upper-left corner & size
281  void initButtonUL(Adafruit_GFX *gfx, int16_t x1, int16_t y1, uint16_t w,
282  uint16_t h, uint16_t outline, uint16_t fill,
283  uint16_t textcolor, const char *label, uint8_t textsize);
284  void initButtonUL(Adafruit_GFX *gfx, int16_t x1, int16_t y1, uint16_t w,
285  uint16_t h, uint16_t outline, uint16_t fill,
286  uint16_t textcolor, const char *label, uint8_t textsize_x,
287  uint8_t textsize_y);
288  void drawButton(bool inverted = false);
289  bool contains(int16_t x, int16_t y);
290 
291  /**********************************************************************/
296  /**********************************************************************/
297  void press(bool p) {
298  laststate = currstate;
299  currstate = p;
300  }
301 
302  bool justPressed();
303  bool justReleased();
304 
305  /**********************************************************************/
310  /**********************************************************************/
311  bool isPressed(void) { return currstate; };
312 
313 private:
314  Adafruit_GFX *_gfx;
315  int16_t _x1, _y1; // Coordinates of top-left corner
316  uint16_t _w, _h;
317  uint8_t _textsize_x;
318  uint8_t _textsize_y;
319  uint16_t _outlinecolor, _fillcolor, _textcolor;
320  char _label[10];
321 
322  bool currstate, laststate;
323 };
324 
326 class GFXcanvas1 : public Adafruit_GFX {
327 public:
328  GFXcanvas1(uint16_t w, uint16_t h, bool allocate_buffer = true);
329  ~GFXcanvas1(void);
330  void drawPixel(int16_t x, int16_t y, uint16_t color);
331  void fillScreen(uint16_t color);
332  void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
333  void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
334  bool getPixel(int16_t x, int16_t y) const;
335  /**********************************************************************/
340  /**********************************************************************/
341  uint8_t *getBuffer(void) const { return buffer; }
342 
343 protected:
344  bool getRawPixel(int16_t x, int16_t y) const;
345  void drawFastRawVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
346  void drawFastRawHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
347  uint8_t *buffer;
349 
351 private:
352 #ifdef __AVR__
353  // Bitmask tables of 0x80>>X and ~(0x80>>X), because X>>Y is slow on AVR
354  static const uint8_t PROGMEM GFXsetBit[], GFXclrBit[];
355 #endif
356 };
357 
359 class GFXcanvas8 : public Adafruit_GFX {
360 public:
361  GFXcanvas8(uint16_t w, uint16_t h, bool allocate_buffer = true);
362  ~GFXcanvas8(void);
363  void drawPixel(int16_t x, int16_t y, uint16_t color);
364  void fillScreen(uint16_t color);
365  void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
366  void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
367  uint8_t getPixel(int16_t x, int16_t y) const;
368  /**********************************************************************/
373  /**********************************************************************/
374  uint8_t *getBuffer(void) const { return buffer; }
375 
376 protected:
377  uint8_t getRawPixel(int16_t x, int16_t y) const;
378  void drawFastRawVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
379  void drawFastRawHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
380  uint8_t *buffer;
382 };
384 
386 class GFXcanvas16 : public Adafruit_GFX {
387 public:
388  GFXcanvas16(uint16_t w, uint16_t h, bool allocate_buffer = true);
389  ~GFXcanvas16(void);
390  void drawPixel(int16_t x, int16_t y, uint16_t color);
391  void fillScreen(uint16_t color);
392  void byteSwap(void);
393  void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
394  void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
395  uint16_t getPixel(int16_t x, int16_t y) const;
396  /**********************************************************************/
401  /**********************************************************************/
402  uint16_t *getBuffer(void) const { return buffer; }
403 
404 protected:
405  uint16_t getRawPixel(int16_t x, int16_t y) const;
406  void drawFastRawVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
407  void drawFastRawHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
408  uint16_t *buffer;
410 };
412 
413 #endif // _ADAFRUIT_GFX_H
uint8_t * getBuffer(void) const
Get a pointer to the internal buffer memory.
Definition: Adafruit_GFX.h:374
void fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color)
Half-circle drawer with fill, used for circles and roundrects.
Definition: Adafruit_GFX.cpp:589
bool isPressed(void)
Query whether the button is currently pressed.
Definition: Adafruit_GFX.h:311
virtual void writePixel(int16_t x, int16_t y, uint16_t color)
Write a pixel, overwrite in subclasses if startWrite is defined!
Definition: Adafruit_GFX.cpp:190
void setTextColor(uint16_t c, uint16_t bg)
Set text font color with custom background color.
Definition: Adafruit_GFX.h:169
void drawXBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color)
Draw PROGMEM-resident XBitMap Files (*.xbm), exported from GIMP. Usage: Export from GIMP to *...
Definition: Adafruit_GFX.cpp:1112
Data stored for FONT AS A WHOLE.
Definition: gfxfont.h:21
void setTextWrap(bool w)
Set whether text that is too long for the screen width should automatically wrap around to the next l...
Definition: Adafruit_GFX.h:181
Definition: Adafruit_GFX.h:18
bool buffer_owned
Definition: Adafruit_GFX.h:348
void fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color)
Draw a circle with filled color.
Definition: Adafruit_GFX.cpp:569
uint8_t * getBuffer(void) const
Get a pointer to the internal buffer memory.
Definition: Adafruit_GFX.h:341
virtual void drawPixel(int16_t x, int16_t y, uint16_t color)=0
Draw to the screen/framebuffer/etc. Must be overridden in subclass.
void fillRotatedRect(int16_t cenX, int16_t cenY, int16_t w, int16_t h, int16_t angleDeg, uint16_t color)
Draw a filled rotated rectangle.
Definition: Adafruit_GFX.cpp:785
virtual void endWrite(void)
End a display-writing routine, overwrite in subclasses if startWrite is defined!
Definition: Adafruit_GFX.cpp:253
uint8_t * buffer
Raster data: no longer private, allow subclass access.
Definition: Adafruit_GFX.h:347
void fillEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh, uint16_t color)
Draw an ellipse with filled colour.
Definition: Adafruit_GFX.cpp:417
void drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size)
Draw a single character.
Definition: Adafruit_GFX.cpp:1414
int16_t getCursorX(void) const
Get text cursor X location.
Definition: Adafruit_GFX.h:238
virtual void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
Write a rectangle completely with one color, overwrite in subclasses if startWrite is defined! ...
Definition: Adafruit_GFX.cpp:241
int16_t cursor_y
y location to start print()ing text
Definition: Adafruit_GFX.h:256
void drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
Draw a triangle with no fill color.
Definition: Adafruit_GFX.cpp:861
GFXfont * gfxFont
Pointer to special font.
Definition: Adafruit_GFX.h:264
void drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
Draw a rounded rectangle with no fill color.
Definition: Adafruit_GFX.cpp:664
A GFX 1-bit canvas context for graphics.
Definition: Adafruit_GFX.h:326
void setFont(const GFXfont *f=NULL)
Set the font to display when print()ing, either custom or default.
Definition: Adafruit_GFX.cpp:1637
uint8_t textsize_x
Desired magnification in X-axis of text to print()
Definition: Adafruit_GFX.h:259
uint8_t * buffer
Raster data: no longer private, allow subclass access.
Definition: Adafruit_GFX.h:380
A GFX 16-bit canvas context for graphics.
Definition: Adafruit_GFX.h:386
virtual void invertDisplay(bool i)
Invert the display (ideally using built-in hardware command)
Definition: Adafruit_GFX.cpp:1839
void drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color)
Quarter-circle drawer, used to do circles and roundrects.
Definition: Adafruit_GFX.cpp:522
void press(bool p)
Sets button state, should be done by some touch function.
Definition: Adafruit_GFX.h:297
void drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[], int16_t w, int16_t h)
Draw a PROGMEM-resident 16-bit image (RGB 5/6/5) at the specified (x,y) position. For 16-bit display ...
Definition: Adafruit_GFX.cpp:1300
bool _cp437
If set, use correct CP437 charset (default is off)
Definition: Adafruit_GFX.h:263
A GFX 8-bit canvas context for graphics.
Definition: Adafruit_GFX.h:359
void setTextColor(uint16_t c)
Set text font color with transparant background.
Definition: Adafruit_GFX.h:160
virtual void writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
Write a line. Bresenham&#39;s algorithm - thx wikpedia.
Definition: Adafruit_GFX.cpp:132
virtual void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
Fill a rectangle completely with one color. Update in subclasses if desired!
Definition: Adafruit_GFX.cpp:300
int16_t height(void) const
Get height of the display, accounting for current rotation.
Definition: Adafruit_GFX.h:220
void cp437(bool x=true)
Enable (or disable) Code Page 437-compatible charset. There was an error in glcdfont.c for the longest time – one character (#176, the &#39;light shade&#39; block) was missing – this threw off the index of every character that followed it. But a TON of code has been written with the erroneous character indices. By default, the library uses the original &#39;wrong&#39; behavior and old sketches will still work. Pass &#39;true&#39; to this function to use correct CP437 character values in your code.
Definition: Adafruit_GFX.h:197
virtual void setRotation(uint8_t r)
Set rotation setting for display.
Definition: Adafruit_GFX.cpp:1615
void drawRotatedRect(int16_t cenX, int16_t cenY, int16_t w, int16_t h, int16_t angleDeg, uint16_t color)
Draw a rotated rectangle.
Definition: Adafruit_GFX.cpp:725
bool buffer_owned
Definition: Adafruit_GFX.h:381
void drawGrayscaleBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h)
Draw a PROGMEM-resident 8-bit image (grayscale) at the specified (x,y) pos. Specifically for 8-bit di...
Definition: Adafruit_GFX.cpp:1184
bool buffer_owned
Definition: Adafruit_GFX.h:409
void charBounds(unsigned char c, int16_t *x, int16_t *y, int16_t *minx, int16_t *miny, int16_t *maxx, int16_t *maxy)
Helper to determine size of a character with current font/size. Broke this out as it&#39;s used by both t...
Definition: Adafruit_GFX.cpp:1670
uint8_t getRotation(void) const
Get rotation setting for display.
Definition: Adafruit_GFX.h:228
void setTextSize(uint8_t s)
Set text &#39;magnification&#39; size. Each increase in s makes 1 pixel that much bigger. ...
Definition: Adafruit_GFX.cpp:1594
uint16_t textbgcolor
16-bit background color for print()
Definition: Adafruit_GFX.h:258
Adafruit_GFX(int16_t w, int16_t h)
Instatiate a GFX context for graphics! Can only be done by a superclass.
Definition: Adafruit_GFX.cpp:110
int16_t cursor_x
x location to start print()ing text
Definition: Adafruit_GFX.h:255
uint8_t textsize_y
Desired magnification in Y-axis of text to print()
Definition: Adafruit_GFX.h:260
int16_t _height
Display height as modified by current rotation.
Definition: Adafruit_GFX.h:254
void rotatePoint(int16_t &x0, int16_t &y0, int16_t angleDeg)
Rotate a point in standard position.
Definition: Adafruit_GFX.cpp:836
int16_t _width
Display width as modified by current rotation.
Definition: Adafruit_GFX.h:253
void fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
Draw a rounded rectangle with fill color.
Definition: Adafruit_GFX.cpp:694
virtual void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Draw a perfectly horizontal line (this is often optimized in a subclass!)
Definition: Adafruit_GFX.cpp:282
int16_t getCursorY(void) const
Get text cursor Y location.
Definition: Adafruit_GFX.h:246
uint8_t rotation
Display rotation (0 thru 3)
Definition: Adafruit_GFX.h:261
void setCursor(int16_t x, int16_t y)
Set text cursor location.
Definition: Adafruit_GFX.h:147
uint16_t * buffer
Raster data: no longer private, allow subclass access.
Definition: Adafruit_GFX.h:408
void drawEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh, uint16_t color)
Draw an ellipse outline.
Definition: Adafruit_GFX.cpp:358
uint16_t textcolor
16-bit text color for print()
Definition: Adafruit_GFX.h:257
bool wrap
If set, &#39;wrap&#39; text at right edge of display.
Definition: Adafruit_GFX.h:262
void fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
Draw a triangle with color-fill.
Definition: Adafruit_GFX.cpp:880
uint16_t * getBuffer(void) const
Get a pointer to the internal buffer memory.
Definition: Adafruit_GFX.h:402
virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Draw a perfectly vertical line (this is often optimized in a subclass!)
Definition: Adafruit_GFX.cpp:265
virtual void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
Draw a line.
Definition: Adafruit_GFX.cpp:330
virtual void startWrite(void)
Start a display-writing routine, overwrite in subclasses.
Definition: Adafruit_GFX.cpp:180
int16_t HEIGHT
This is the &#39;raw&#39; display height - never changes.
Definition: Adafruit_GFX.h:252
void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color)
Draw a circle outline.
Definition: Adafruit_GFX.cpp:472
virtual void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Write a perfectly horizontal line, overwrite in subclasses if startWrite is defined! ...
Definition: Adafruit_GFX.cpp:222
void drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color)
Draw a PROGMEM-resident 1-bit image at the specified (x,y) position, using the specified foreground c...
Definition: Adafruit_GFX.cpp:978
virtual void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Write a perfectly vertical line, overwrite in subclasses if startWrite is defined! ...
Definition: Adafruit_GFX.cpp:204
A simple drawn button UI element.
Definition: Adafruit_GFX.h:268
virtual void drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
Draw a rectangle with no fill color.
Definition: Adafruit_GFX.cpp:643
void getTextBounds(const char *string, int16_t x, int16_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h)
Helper to determine size of a string with current font/size. Pass string and a cursor position...
Definition: Adafruit_GFX.cpp:1747
virtual void write(uint8_t)
Print one byte/character of data, used to support print()
Definition: Adafruit_GFX.cpp:1541
virtual void fillScreen(uint16_t color)
Fill the screen completely with one color. Update in subclasses if desired!
Definition: Adafruit_GFX.cpp:316
int16_t WIDTH
This is the &#39;raw&#39; display width - never changes.
Definition: Adafruit_GFX.h:251
int16_t width(void) const
Get width of the display, accounting for current rotation.
Definition: Adafruit_GFX.h:212