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  virtual void clearDisplay(void);
52  virtual void display(void);
53 
54  // CONTROL API
55  // These MAY be overridden by the subclass to provide device-specific
56  // optimized code. Otherwise 'generic' versions are used.
57  virtual void setRotation(uint8_t r);
58  virtual void invertDisplay(bool i);
59 
60  // BASIC DRAW API
61  // These MAY be overridden by the subclass to provide device-specific
62  // optimized code. Otherwise 'generic' versions are used.
63 
64  // It's good to implement those, even if using transaction API
65  virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
66  virtual void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
67  virtual void fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
68  uint16_t color);
69  virtual void fillScreen(uint16_t color);
70  // Optional and probably not necessary to change
71  virtual void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
72  uint16_t color);
73  virtual void drawRect(int16_t x, int16_t y, int16_t w, int16_t h,
74  uint16_t color);
75 
76  // These exist only with Adafruit_GFX (no subclass overrides)
77  void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
78  void drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername,
79  uint16_t color);
80  void fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
81  void fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername,
82  int16_t delta, uint16_t color);
83  void fillQuarterCircle(int16_t x0, int16_t y0, int16_t r, uint8_t corners,
84  uint16_t color);
85  void drawEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh,
86  uint16_t color);
87  void fillEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh,
88  uint16_t color);
89  void drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2,
90  int16_t y2, uint16_t color);
91  void fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2,
92  int16_t y2, uint16_t color);
93  void drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
94  int16_t radius, uint16_t color);
95  void fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
96  int16_t radius, uint16_t color);
97  void drawRotatedRect(int16_t cenX, int16_t cenY, int16_t w, int16_t h,
98  int16_t angleDeg, uint16_t color);
99  void fillRotatedRect(int16_t cenX, int16_t cenY, int16_t w, int16_t h,
100  int16_t angleDeg, uint16_t color);
101  void rotatePoint(int16_t &x0, int16_t &y0, int16_t angleDeg);
102  void drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w,
103  int16_t h, uint16_t color);
104  void drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w,
105  int16_t h, uint16_t color, uint16_t bg);
106  void drawBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h,
107  uint16_t color);
108  void drawBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h,
109  uint16_t color, uint16_t bg);
110  void drawXBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w,
111  int16_t h, uint16_t color);
112  void drawXBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w,
113  int16_t h, uint16_t color, uint16_t bg);
114  void drawGrayscaleBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
115  int16_t w, int16_t h);
116  void drawGrayscaleBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w,
117  int16_t h);
118  void drawGrayscaleBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
119  const uint8_t mask[], int16_t w, int16_t h);
120  void drawGrayscaleBitmap(int16_t x, int16_t y, uint8_t *bitmap, uint8_t *mask,
121  int16_t w, int16_t h);
122  void drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[], int16_t w,
123  int16_t h);
124  void drawRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w,
125  int16_t h);
126  void drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[],
127  const uint8_t mask[], int16_t w, int16_t h);
128  void drawRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, uint8_t *mask,
129  int16_t w, int16_t h);
130  void drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color,
131  uint16_t bg, uint8_t size);
132  void drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color,
133  uint16_t bg, uint8_t size_x, uint8_t size_y);
134  void getTextBounds(const char *string, int16_t x, int16_t y, int16_t *x1,
135  int16_t *y1, uint16_t *w, uint16_t *h);
136  void getTextBounds(const __FlashStringHelper *s, int16_t x, int16_t y,
137  int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h);
138  void getTextBounds(const String &str, int16_t x, int16_t y, int16_t *x1,
139  int16_t *y1, uint16_t *w, uint16_t *h);
140  void setTextSize(uint8_t s);
141  void setTextSize(uint8_t sx, uint8_t sy);
142  void setFont(const GFXfont *f = NULL);
143 
144  /**********************************************************************/
149  /**********************************************************************/
150  GFXfont *getFont() const { return gfxFont; }
151 
152  /**********************************************************************/
157  /**********************************************************************/
158  uint8_t getTextSizeX() const { return textsize_x; }
159 
160  /**********************************************************************/
165  /**********************************************************************/
166  uint8_t getTextSizeY() const { return textsize_y; }
167 
168  /**********************************************************************/
174  /**********************************************************************/
175  void setCursor(int16_t x, int16_t y) {
176  cursor_x = x;
177  cursor_y = y;
178  }
179 
180  /**********************************************************************/
187  /**********************************************************************/
188  void setTextColor(uint16_t c) { textcolor = textbgcolor = c; }
189 
190  /**********************************************************************/
196  /**********************************************************************/
197  void setTextColor(uint16_t c, uint16_t bg) {
198  textcolor = c;
199  textbgcolor = bg;
200  }
201 
202  /**********************************************************************/
207  /**********************************************************************/
208  uint16_t getTextColor() const { return textcolor; }
209 
210  /**********************************************************************/
215  /**********************************************************************/
216  uint16_t getTextBgColor() const { return textbgcolor; }
217 
218  /**********************************************************************/
224  /**********************************************************************/
225  void setTextWrap(bool w) { wrap = w; }
226 
227  /**********************************************************************/
240  /**********************************************************************/
241  void cp437(bool x = true) { _cp437 = x; }
242 
243  using Print::write;
244 #if ARDUINO >= 100
245  virtual size_t write(uint8_t);
246 #else
247  virtual void write(uint8_t);
248 #endif
249 
250  /************************************************************************/
255  /************************************************************************/
256  int16_t width(void) const { return _width; };
257 
258  /************************************************************************/
263  /************************************************************************/
264  int16_t height(void) const { return _height; }
265 
266  /************************************************************************/
271  /************************************************************************/
272  uint8_t getRotation(void) const { return rotation; }
273 
274  // get current cursor position (get rotation safe maximum values,
275  // using: width() for x, height() for y)
276  /************************************************************************/
281  /************************************************************************/
282  int16_t getCursorX(void) const { return cursor_x; }
283 
284  /************************************************************************/
289  /************************************************************************/
290  int16_t getCursorY(void) const { return cursor_y; };
291 
292 protected:
293  void charBounds(unsigned char c, int16_t *x, int16_t *y, int16_t *minx,
294  int16_t *miny, int16_t *maxx, int16_t *maxy);
295  int16_t WIDTH;
296  int16_t HEIGHT;
297  int16_t _width;
298  int16_t _height;
299  int16_t cursor_x;
300  int16_t cursor_y;
301  uint16_t textcolor;
302  uint16_t textbgcolor;
303  uint8_t textsize_x;
304  uint8_t textsize_y;
305  uint8_t rotation;
306  bool wrap;
307  bool _cp437;
309 };
310 
313 
314 public:
315  Adafruit_GFX_Button(void);
316  // "Classic" initButton() uses center & size
317  void initButton(Adafruit_GFX *gfx, int16_t x, int16_t y, uint16_t w,
318  uint16_t h, uint16_t outline, uint16_t fill,
319  uint16_t textcolor, const char *label, uint8_t textsize);
320  void initButton(Adafruit_GFX *gfx, int16_t x, int16_t y, uint16_t w,
321  uint16_t h, uint16_t outline, uint16_t fill,
322  uint16_t textcolor, const char *label, uint8_t textsize_x,
323  uint8_t textsize_y);
324  // New/alt initButton() uses upper-left corner & size
325  void initButtonUL(Adafruit_GFX *gfx, int16_t x1, int16_t y1, uint16_t w,
326  uint16_t h, uint16_t outline, uint16_t fill,
327  uint16_t textcolor, const char *label, uint8_t textsize);
328  void initButtonUL(Adafruit_GFX *gfx, int16_t x1, int16_t y1, uint16_t w,
329  uint16_t h, uint16_t outline, uint16_t fill,
330  uint16_t textcolor, const char *label, uint8_t textsize_x,
331  uint8_t textsize_y);
332  void drawButton(bool inverted = false);
333  bool contains(int16_t x, int16_t y);
334 
335  /**********************************************************************/
340  /**********************************************************************/
341  void press(bool p) {
342  laststate = currstate;
343  currstate = p;
344  }
345 
346  bool justPressed();
347  bool justReleased();
348 
349  /**********************************************************************/
354  /**********************************************************************/
355  bool isPressed(void) { return currstate; };
356 
357  /**********************************************************************/
362  /**********************************************************************/
363  const char *getLabel(void) const { return _label; };
364 
365 private:
366  Adafruit_GFX *_gfx;
367  int16_t _x1, _y1; // Coordinates of top-left corner
368  uint16_t _w, _h;
369  uint8_t _textsize_x;
370  uint8_t _textsize_y;
371  uint16_t _outlinecolor, _fillcolor, _textcolor;
372  char _label[10];
373 
374  bool currstate, laststate;
375 };
376 
378 class GFXcanvas1 : public Adafruit_GFX {
379 public:
380  GFXcanvas1(uint16_t w, uint16_t h, bool allocate_buffer = true);
381  ~GFXcanvas1(void);
382  void drawPixel(int16_t x, int16_t y, uint16_t color);
383  void fillScreen(uint16_t color);
384  void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
385  void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
386  bool getPixel(int16_t x, int16_t y) const;
387  /**********************************************************************/
392  /**********************************************************************/
393  uint8_t *getBuffer(void) const { return buffer; }
394 
395 protected:
396  bool getRawPixel(int16_t x, int16_t y) const;
397  void drawFastRawVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
398  void drawFastRawHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
399  uint8_t *buffer;
401 
403 private:
404  // No copies: the copy and the original would both free the buffer
405  GFXcanvas1(const GFXcanvas1 &) = delete;
406  GFXcanvas1 &operator=(const GFXcanvas1 &) = delete;
407 #ifdef __AVR__
408  // Bitmask tables of 0x80>>X and ~(0x80>>X), because X>>Y is slow on AVR
409  static const uint8_t PROGMEM GFXsetBit[], GFXclrBit[];
410 #endif
411 };
412 
414 class GFXcanvas8 : public Adafruit_GFX {
415 public:
416  GFXcanvas8(uint16_t w, uint16_t h, bool allocate_buffer = true);
417  ~GFXcanvas8(void);
418  void drawPixel(int16_t x, int16_t y, uint16_t color);
419  void fillScreen(uint16_t color);
420  void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
421  void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
422  uint8_t getPixel(int16_t x, int16_t y) const;
423  /**********************************************************************/
428  /**********************************************************************/
429  uint8_t *getBuffer(void) const { return buffer; }
430 
431 protected:
432  uint8_t getRawPixel(int16_t x, int16_t y) const;
433  void drawFastRawVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
434  void drawFastRawHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
435  uint8_t *buffer;
437 
439 private:
440  // No copies: the copy and the original would both free the buffer
441  GFXcanvas8(const GFXcanvas8 &) = delete;
442  GFXcanvas8 &operator=(const GFXcanvas8 &) = delete;
443 };
444 
446 class GFXcanvas16 : public Adafruit_GFX {
447 public:
448  GFXcanvas16(uint16_t w, uint16_t h, bool allocate_buffer = true);
449  ~GFXcanvas16(void);
450  void drawPixel(int16_t x, int16_t y, uint16_t color);
451  void fillScreen(uint16_t color);
452  void byteSwap(void);
453  void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
454  void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
455  uint16_t getPixel(int16_t x, int16_t y) const;
456  /**********************************************************************/
461  /**********************************************************************/
462  uint16_t *getBuffer(void) const { return buffer; }
463 
464 protected:
465  uint16_t getRawPixel(int16_t x, int16_t y) const;
466  void drawFastRawVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
467  void drawFastRawHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
468  uint16_t *buffer;
470 
472 private:
473  // No copies: the copy and the original would both free the buffer
474  GFXcanvas16(const GFXcanvas16 &) = delete;
475  GFXcanvas16 &operator=(const GFXcanvas16 &) = delete;
476 };
477 
478 #endif // _ADAFRUIT_GFX_H
uint8_t * getBuffer(void) const
Get a pointer to the internal buffer memory.
Definition: Adafruit_GFX.h:429
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:603
bool isPressed(void)
Query whether the button is currently pressed.
Definition: Adafruit_GFX.h:355
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:204
void setTextColor(uint16_t c, uint16_t bg)
Set text font color with custom background color.
Definition: Adafruit_GFX.h:197
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:1193
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:225
Definition: Adafruit_GFX.h:18
bool buffer_owned
Definition: Adafruit_GFX.h:400
void fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color)
Draw a circle with filled color.
Definition: Adafruit_GFX.cpp:583
uint8_t * getBuffer(void) const
Get a pointer to the internal buffer memory.
Definition: Adafruit_GFX.h:393
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:866
virtual void endWrite(void)
End a display-writing routine, overwrite in subclasses if startWrite is defined!
Definition: Adafruit_GFX.cpp:267
uint16_t getTextColor() const
Get text color.
Definition: Adafruit_GFX.h:208
uint8_t * buffer
Raster data: no longer private, allow subclass access.
Definition: Adafruit_GFX.h:399
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:431
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:1495
int16_t getCursorX(void) const
Get text cursor X location.
Definition: Adafruit_GFX.h:282
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:255
int16_t cursor_y
y location to start print()ing text
Definition: Adafruit_GFX.h:300
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:942
void fillQuarterCircle(int16_t x0, int16_t y0, int16_t r, uint8_t corners, uint16_t color)
Quarter-circle drawer with fill.
Definition: Adafruit_GFX.cpp:659
GFXfont * gfxFont
Pointer to special font.
Definition: Adafruit_GFX.h:308
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:745
A GFX 1-bit canvas context for graphics.
Definition: Adafruit_GFX.h:378
void setFont(const GFXfont *f=NULL)
Set the font to display when print()ing, either custom or default.
Definition: Adafruit_GFX.cpp:1737
uint8_t textsize_x
Desired magnification in X-axis of text to print()
Definition: Adafruit_GFX.h:303
uint16_t getTextBgColor() const
Get text background color.
Definition: Adafruit_GFX.h:216
uint8_t * buffer
Raster data: no longer private, allow subclass access.
Definition: Adafruit_GFX.h:435
A GFX 16-bit canvas context for graphics.
Definition: Adafruit_GFX.h:446
virtual void invertDisplay(bool i)
Invert the display (ideally using built-in hardware command)
Definition: Adafruit_GFX.cpp:1939
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:536
void press(bool p)
Sets button state, should be done by some touch function.
Definition: Adafruit_GFX.h:341
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:1381
bool _cp437
If set, use correct CP437 charset (default is off)
Definition: Adafruit_GFX.h:307
A GFX 8-bit canvas context for graphics.
Definition: Adafruit_GFX.h:414
void setTextColor(uint16_t c)
Set text font color with transparant background.
Definition: Adafruit_GFX.h:188
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 Wikipedia.
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:314
int16_t height(void) const
Get height of the display, accounting for current rotation.
Definition: Adafruit_GFX.h:264
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:241
virtual void setRotation(uint8_t r)
Set rotation setting for display.
Definition: Adafruit_GFX.cpp:1715
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:806
bool buffer_owned
Definition: Adafruit_GFX.h:436
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:1265
bool buffer_owned
Definition: Adafruit_GFX.h:469
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:1770
uint8_t getRotation(void) const
Get rotation setting for display.
Definition: Adafruit_GFX.h:272
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:1694
uint16_t textbgcolor
16-bit background color for print()
Definition: Adafruit_GFX.h:302
Adafruit_GFX(int16_t w, int16_t h)
Instantiate 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:299
uint8_t textsize_y
Desired magnification in Y-axis of text to print()
Definition: Adafruit_GFX.h:304
GFXfont * getFont() const
Get GFX font.
Definition: Adafruit_GFX.h:150
int16_t _height
Display height as modified by current rotation.
Definition: Adafruit_GFX.h:298
void rotatePoint(int16_t &x0, int16_t &y0, int16_t angleDeg)
Rotate a point in standard position.
Definition: Adafruit_GFX.cpp:917
int16_t _width
Display width as modified by current rotation.
Definition: Adafruit_GFX.h:297
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:775
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:296
int16_t getCursorY(void) const
Get text cursor Y location.
Definition: Adafruit_GFX.h:290
uint8_t rotation
Display rotation (0 thru 3)
Definition: Adafruit_GFX.h:305
virtual void display(void)
Update the display, overwrite in subclasses.
Definition: Adafruit_GFX.cpp:187
void setCursor(int16_t x, int16_t y)
Set text cursor location.
Definition: Adafruit_GFX.h:175
uint16_t * buffer
Raster data: no longer private, allow subclass access.
Definition: Adafruit_GFX.h:468
uint8_t getTextSizeX() const
Get text size multiplier x.
Definition: Adafruit_GFX.h:158
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:372
uint16_t textcolor
16-bit text color for print()
Definition: Adafruit_GFX.h:301
virtual void clearDisplay(void)
Clear the display, overwrite in subclasses.
Definition: Adafruit_GFX.cpp:180
bool wrap
If set, &#39;wrap&#39; text at right edge of display.
Definition: Adafruit_GFX.h:306
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:961
uint16_t * getBuffer(void) const
Get a pointer to the internal buffer memory.
Definition: Adafruit_GFX.h:462
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:279
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:344
virtual void startWrite(void)
Start a display-writing routine, overwrite in subclasses.
Definition: Adafruit_GFX.cpp:194
const char * getLabel(void) const
Get the label text.
Definition: Adafruit_GFX.h:363
int16_t HEIGHT
This is the &#39;raw&#39; display height - never changes.
Definition: Adafruit_GFX.h:296
void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color)
Draw a circle outline.
Definition: Adafruit_GFX.cpp:486
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:236
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:1059
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:218
A simple drawn button UI element.
Definition: Adafruit_GFX.h:312
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:724
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:1847
virtual void write(uint8_t)
Print one byte/character of data, used to support print()
Definition: Adafruit_GFX.cpp:1641
virtual void fillScreen(uint16_t color)
Fill the screen completely with one color. Update in subclasses if desired!
Definition: Adafruit_GFX.cpp:330
uint8_t getTextSizeY() const
Get text size multiplier y.
Definition: Adafruit_GFX.h:166
int16_t WIDTH
This is the &#39;raw&#39; display width - never changes.
Definition: Adafruit_GFX.h:295
int16_t width(void) const
Get width of the display, accounting for current rotation.
Definition: Adafruit_GFX.h:256