25 virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0;
31 virtual void writePixel(int16_t x, int16_t y, uint16_t color);
32 virtual void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h,
34 virtual void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
35 virtual void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
36 virtual void writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
51 virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
52 virtual void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
53 virtual void fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
57 virtual void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
59 virtual void drawRect(int16_t x, int16_t y, int16_t w, int16_t h,
63 void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
66 void fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
68 int16_t delta, uint16_t color);
69 void drawEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh,
71 void fillEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh,
73 void drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2,
74 int16_t y2, uint16_t color);
75 void fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2,
76 int16_t y2, uint16_t color);
77 void drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
78 int16_t radius, uint16_t color);
79 void fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
80 int16_t radius, uint16_t color);
82 int16_t angleDeg, uint16_t color);
84 int16_t angleDeg, uint16_t color);
85 void rotatePoint(int16_t &x0, int16_t &y0, int16_t angleDeg);
86 void drawBitmap(int16_t x, int16_t y,
const uint8_t bitmap[], int16_t w,
87 int16_t h, uint16_t color);
88 void drawBitmap(int16_t x, int16_t y,
const uint8_t bitmap[], int16_t w,
89 int16_t h, uint16_t color, uint16_t bg);
90 void drawBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h,
92 void drawBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h,
93 uint16_t color, uint16_t bg);
94 void drawXBitmap(int16_t x, int16_t y,
const uint8_t bitmap[], int16_t w,
95 int16_t h, uint16_t color);
97 int16_t w, int16_t h);
101 const uint8_t mask[], int16_t w, int16_t h);
103 int16_t w, int16_t h);
104 void drawRGBBitmap(int16_t x, int16_t y,
const uint16_t bitmap[], int16_t w,
106 void drawRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w,
108 void drawRGBBitmap(int16_t x, int16_t y,
const uint16_t bitmap[],
109 const uint8_t mask[], int16_t w, int16_t h);
110 void drawRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, uint8_t *mask,
111 int16_t w, int16_t h);
112 void drawChar(int16_t x, int16_t y,
unsigned char c, uint16_t color,
113 uint16_t bg, uint8_t size);
114 void drawChar(int16_t x, int16_t y,
unsigned char c, uint16_t color,
115 uint16_t bg, uint8_t size_x, uint8_t size_y);
116 void getTextBounds(
const char *
string, int16_t x, int16_t y, int16_t *x1,
117 int16_t *y1, uint16_t *w, uint16_t *h);
118 void getTextBounds(
const __FlashStringHelper *s, int16_t x, int16_t y,
119 int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h);
121 int16_t *y1, uint16_t *w, uint16_t *h);
124 void setFont(
const GFXfont *f = NULL);
187 virtual size_t write(uint8_t);
189 virtual void write(uint8_t);
235 void charBounds(
unsigned char c, int16_t *x, int16_t *y, int16_t *minx,
236 int16_t *miny, int16_t *maxx, int16_t *maxy);
260 uint16_t h, uint16_t outline, uint16_t fill,
261 uint16_t textcolor,
char *label, uint8_t textsize);
263 uint16_t h, uint16_t outline, uint16_t fill,
264 uint16_t textcolor,
char *label, uint8_t textsize_x,
268 uint16_t h, uint16_t outline, uint16_t fill,
269 uint16_t textcolor,
char *label, uint8_t textsize);
271 uint16_t h, uint16_t outline, uint16_t fill,
272 uint16_t textcolor,
char *label, uint8_t textsize_x,
275 bool contains(int16_t x, int16_t y);
284 laststate = currstate;
305 uint16_t _outlinecolor, _fillcolor, _textcolor;
308 bool currstate, laststate;
314 GFXcanvas1(uint16_t w, uint16_t h,
bool allocate_buffer =
true);
316 void drawPixel(int16_t x, int16_t y, uint16_t color);
318 void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
319 void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
320 bool getPixel(int16_t x, int16_t y)
const;
340 static const uint8_t PROGMEM GFXsetBit[], GFXclrBit[];
347 GFXcanvas8(uint16_t w, uint16_t h,
bool allocate_buffer =
true);
349 void drawPixel(int16_t x, int16_t y, uint16_t color);
351 void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
352 void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
353 uint8_t
getPixel(int16_t x, int16_t y)
const;
374 GFXcanvas16(uint16_t w, uint16_t h,
bool allocate_buffer =
true);
376 void drawPixel(int16_t x, int16_t y, uint16_t color);
379 void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
380 void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
381 uint16_t
getPixel(int16_t x, int16_t y)
const;
Arduino-compatible Print base class (independent implementation).
Minimal Arduino-API compatibility layer for the STM32 port of Adafruit_GFX (and libraries built on it...
int16_t getCursorX(void) const
Get text cursor X location.
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!)
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.
uint16_t textbgcolor
16-bit text color for print()
virtual void fillScreen(uint16_t color)
Fill the screen completely with one color. Update in subclasses if desired!
int16_t HEIGHT
This is the 'raw' display height - never changes.
void setTextWrap(bool w)
Set whether text that is too long for the screen width should automatically wrap around to the next l...
int16_t width(void) const
Get width of the display, accounting for current rotation.
uint8_t rotation
Display rotation (0 thru 3)
void setTextSize(uint8_t s)
Set text 'magnification' size. Each increase in s makes 1 pixel that much bigger.
void rotatePoint(int16_t &x0, int16_t &y0, int16_t angleDeg)
Rotate a point in standard position.
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.
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.
virtual void invertDisplay(bool i)
Invert the display (ideally using built-in hardware command)
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.
int16_t height(void) const
Get height of the display, accounting for current rotation.
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.
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!)
void setTextColor(uint16_t c)
Set text font color with transparant background.
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!
void fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color)
Draw a circle with filled color.
void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color)
Draw a circle outline.
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's used by both t...
virtual void setRotation(uint8_t r)
Set rotation setting for display.
Adafruit_GFX(int16_t w, int16_t h)
Instatiate a GFX context for graphics! Can only be done by a superclass.
bool _cp437
If set, use correct CP437 charset (default is off)
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.
void fillEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh, uint16_t color)
Draw an ellipse with filled colour.
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...
int16_t getCursorY(void) const
Get text cursor Y location.
virtual void write(uint8_t)
Print one byte/character of data, used to support print()
bool wrap
If set, 'wrap' text at right edge of display.
uint16_t textcolor
16-bit background color for print()
int16_t cursor_x
x location to start print()ing text
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,...
uint8_t textsize_x
Desired magnification in X-axis of text to print()
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.
virtual void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
Draw a line.
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!
void drawEllipse(int16_t x0, int16_t y0, int16_t rw, int16_t rh, uint16_t color)
Draw an ellipse outline.
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 *....
uint8_t textsize_y
Desired magnification in Y-axis of text to print()
virtual void startWrite(void)
Start a display-writing routine, overwrite in subclasses.
void setCursor(int16_t x, int16_t y)
Set text cursor location.
void setFont(const GFXfont *f=NULL)
Set the font to display when print()ing, either custom or default.
int16_t _width
Display width as modified by current rotation.
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.
virtual void writePixel(int16_t x, int16_t y, uint16_t color)
Write a pixel, overwrite in subclasses if startWrite is defined!
void setTextColor(uint16_t c, uint16_t bg)
Set text font color with custom background color.
void drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size)
Draw a single character.
virtual void drawPixel(int16_t x, int16_t y, uint16_t color)=0
Draw to the screen/framebuffer/etc. Must be overridden in subclass.
uint8_t getRotation(void) const
Get rotation setting for display.
int16_t _height
Display height as modified by current rotation.
virtual void endWrite(void)
End a display-writing routine, overwrite in subclasses if startWrite is defined!
void cp437(bool x=true)
Enable (or disable) Code Page 437-compatible charset. There was an error in glcdfont....
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!
int16_t WIDTH
This is the 'raw' display width - never changes.
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!
virtual void writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
Write a line. Bresenham's algorithm - thx wikpedia.
int16_t cursor_y
y location to start print()ing text
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...
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 ...
void drawRotatedRect(int16_t cenX, int16_t cenY, int16_t w, int16_t h, int16_t angleDeg, uint16_t color)
Draw a rotated rectangle.
GFXfont * gfxFont
Pointer to special font.
A GFX 16-bit canvas context for graphics.
void drawFastRawHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Speed optimized horizontal line drawing into the raw canvas buffer.
uint16_t * buffer
Raster data: no longer private, allow subclass access.
~GFXcanvas16(void)
Delete the canvas, free memory.
void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Speed optimized vertical line drawing.
void byteSwap(void)
Reverses the "endian-ness" of each 16-bit pixel within the canvas; little-endian to big-endian,...
void drawFastRawVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Speed optimized vertical line drawing into the raw canvas buffer.
uint16_t * getBuffer(void) const
Get a pointer to the internal buffer memory.
uint16_t getPixel(int16_t x, int16_t y) const
Get the pixel color value at a given coordinate.
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Speed optimized horizontal line drawing.
void drawPixel(int16_t x, int16_t y, uint16_t color)
Draw a pixel to the canvas framebuffer.
void fillScreen(uint16_t color)
Fill the framebuffer completely with one color.
uint16_t getRawPixel(int16_t x, int16_t y) const
Get the pixel color value at a given, unrotated coordinate. This method is intended for hardware driv...
GFXcanvas16(uint16_t w, uint16_t h, bool allocate_buffer=true)
Instatiate a GFX 16-bit canvas context for graphics.
A GFX 1-bit canvas context for graphics.
void drawPixel(int16_t x, int16_t y, uint16_t color)
Draw a pixel to the canvas framebuffer.
void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Speed optimized vertical line drawing.
void drawFastRawVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Speed optimized vertical line drawing into the raw canvas buffer.
GFXcanvas1(uint16_t w, uint16_t h, bool allocate_buffer=true)
Instatiate a GFX 1-bit canvas context for graphics.
bool getRawPixel(int16_t x, int16_t y) const
Get the pixel color value at a given, unrotated coordinate. This method is intended for hardware driv...
void drawFastRawHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Speed optimized horizontal line drawing into the raw canvas buffer.
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Speed optimized horizontal line drawing.
~GFXcanvas1(void)
Delete the canvas, free memory.
bool getPixel(int16_t x, int16_t y) const
Get the pixel color value at a given coordinate.
void fillScreen(uint16_t color)
Fill the framebuffer completely with one color.
uint8_t * buffer
Raster data: no longer private, allow subclass access.
uint8_t * getBuffer(void) const
Get a pointer to the internal buffer memory.
A GFX 8-bit canvas context for graphics.
~GFXcanvas8(void)
Delete the canvas, free memory.
uint8_t getRawPixel(int16_t x, int16_t y) const
Get the pixel color value at a given, unrotated coordinate. This method is intended for hardware driv...
void drawPixel(int16_t x, int16_t y, uint16_t color)
Draw a pixel to the canvas framebuffer.
uint8_t getPixel(int16_t x, int16_t y) const
Get the pixel color value at a given coordinate.
uint8_t * getBuffer(void) const
Get a pointer to the internal buffer memory.
GFXcanvas8(uint16_t w, uint16_t h, bool allocate_buffer=true)
Instatiate a GFX 8-bit canvas context for graphics.
void drawFastRawHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Speed optimized horizontal line drawing into the raw canvas buffer.
void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Speed optimized vertical line drawing.
void fillScreen(uint16_t color)
Fill the framebuffer completely with one color.
uint8_t * buffer
Raster data: no longer private, allow subclass access.
void drawFastRawVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Speed optimized vertical line drawing into the raw canvas buffer.
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Speed optimized horizontal line drawing.
Arduino-compatible text output base class. A subclass provides write(uint8_t); everything else is bui...
virtual size_t write(uint8_t c)=0
Minimal Arduino-String stand-in (see file description).