Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TFT_Touch_botao_v1 TFT_Touch_exemplo5_git_touch TESTE_1 TFT_Touch_exemplo6_git_touch_button_3_ ... more
Adafruit_GFX Class Reference
A generic graphics superclass that can handle all sorts of drawing. More...
#include <Adafruit_GFX.h>
Inherited by GFXcanvas1, GFXcanvas16, and GFXcanvas8.
Public Member Functions | |
| Adafruit_GFX (int16_t w, int16_t h) | |
| Instatiate a GFX context for graphics! Can only be done by a superclass. | |
| virtual void | drawPixel (int16_t x, int16_t y, uint16_t color)=0 |
| Draw to the screen/framebuffer/etc. Must be overridden in subclass. | |
| virtual void | startWrite (void) |
| Start a display-writing routine, overwrite in subclasses. | |
| virtual void | writePixel (int16_t x, int16_t y, uint16_t color) |
| Write a pixel, overwrite in subclasses if startWrite is defined! | |
| 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! | |
| 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 | 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! | |
| 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. | |
| virtual void | endWrite (void) |
| End a display-writing routine, overwrite in subclasses if startWrite is defined! | |
| virtual void | setRotation (uint8_t r) |
| Set rotation setting for display. | |
| virtual void | invertDisplay (bool i) |
| Invert the display (ideally using built-in hardware command) | |
| 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!) | |
| 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!) | |
| 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! | |
| virtual void | fillScreen (uint16_t color) |
| Fill the screen completely with one color. Update in subclasses if desired! | |
| virtual void | drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) |
| Draw a line. | |
| 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. | |
| void | drawCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color) |
| Draw a circle outline. | |
| 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 | fillCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color) |
| Draw a circle with filled color. | |
| void | fillCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color) |
| Quarter-circle drawer with fill, used for circles and roundrects. | |
| 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. | |
| 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. | |
| 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. | |
| 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 | 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 color (unset bits are transparent). | |
| void | drawBitmap (int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color, uint16_t bg) |
| Draw a PROGMEM-resident 1-bit image at the specified (x,y) position, using the specified foreground (for set bits) and background (unset bits) colors. | |
| void | drawBitmap (int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color) |
| Draw a RAM-resident 1-bit image at the specified (x,y) position, using the specified foreground color (unset bits are transparent). | |
| void | drawBitmap (int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color, uint16_t bg) |
| Draw a RAM-resident 1-bit image at the specified (x,y) position, using the specified foreground (for set bits) and background (unset bits) colors. | |
| 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 *.xbm, rename *.xbm to *.c and open in editor. C Array can be directly used with this function. There is no RAM-resident version of this function; if generating bitmaps in RAM, use the format defined by drawBitmap() and call that instead. | |
| 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 display devices such as IS31FL3731; no color reduction/expansion is performed. | |
| void | drawGrayscaleBitmap (int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h) |
| Draw a RAM-resident 8-bit image (grayscale) at the specified (x,y) pos. Specifically for 8-bit display devices such as IS31FL3731; no color reduction/expansion is performed. | |
| void | drawGrayscaleBitmap (int16_t x, int16_t y, const uint8_t bitmap[], const uint8_t mask[], int16_t w, int16_t h) |
| Draw a PROGMEM-resident 8-bit image (grayscale) with a 1-bit mask (set bits = opaque, unset bits = clear) at the specified (x,y) position. BOTH buffers (grayscale and mask) must be PROGMEM-resident. Specifically for 8-bit display devices such as IS31FL3731; no color reduction/expansion is performed. | |
| void | drawGrayscaleBitmap (int16_t x, int16_t y, uint8_t *bitmap, uint8_t *mask, int16_t w, int16_t h) |
| Draw a RAM-resident 8-bit image (grayscale) with a 1-bit mask (set bits = opaque, unset bits = clear) at the specified (x,y) position. BOTH buffers (grayscale and mask) must be RAM-residentt, no mix-and-match Specifically for 8-bit display devices such as IS31FL3731; no color reduction/expansion is performed. | |
| 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 devices; no color reduction performed. | |
| void | drawRGBBitmap (int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) |
| Draw a RAM-resident 16-bit image (RGB 5/6/5) at the specified (x,y) position. For 16-bit display devices; no color reduction performed. | |
| void | drawRGBBitmap (int16_t x, int16_t y, const uint16_t bitmap[], const uint8_t mask[], int16_t w, int16_t h) |
| Draw a PROGMEM-resident 16-bit image (RGB 5/6/5) with a 1-bit mask (set bits = opaque, unset bits = clear) at the specified (x,y) position. BOTH buffers (color and mask) must be PROGMEM-resident. For 16-bit display devices; no color reduction performed. | |
| void | drawRGBBitmap (int16_t x, int16_t y, uint16_t *bitmap, uint8_t *mask, int16_t w, int16_t h) |
| Draw a RAM-resident 16-bit image (RGB 5/6/5) with a 1-bit mask (set bits = opaque, unset bits = clear) at the specified (x,y) position. BOTH buffers (color and mask) must be RAM-resident. For 16-bit display devices; no color reduction performed. | |
| void | drawChar (int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size) |
| Draw a single character. | |
| void | drawChar (int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size_x, uint8_t size_y) |
| Draw a single character. | |
| 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, returns UL corner and W,H. | |
| void | setTextSize (uint8_t s) |
| Set text 'magnification' size. Each increase in s makes 1 pixel that much bigger. | |
| void | setTextSize (uint8_t sx, uint8_t sy) |
| Set text 'magnification' size. Each increase in s makes 1 pixel that much bigger. | |
| void | setFont (const GFXfont *f=NULL) |
| Set the font to display when print()ing, either custom or default. | |
| void | setCursor (int16_t x, int16_t y) |
| Set text cursor location. | |
| void | setTextColor (uint16_t c) |
| Set text font color with transparant background. | |
| void | setTextColor (uint16_t c, uint16_t bg) |
| Set text font color with custom background color. | |
| void | setTextWrap (bool w) |
| Set whether text that is too long for the screen width should automatically wrap around to the next line (else clip right). | |
| 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 'light shade' 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 'wrong' behavior and old sketches will still work. Pass 'true' to this function to use correct CP437 character values in your code. | |
| virtual size_t | write (uint8_t) |
| Print one byte/character of data, used to support print() | |
| int16_t | width (void) const |
| Get width of the display, accounting for current rotation. | |
| int16_t | height (void) const |
| Get height of the display, accounting for current rotation. | |
| uint8_t | getRotation (void) const |
| Get rotation setting for display. | |
| int16_t | getCursorX (void) const |
| Get text cursor X location. | |
| int16_t | getCursorY (void) const |
| Get text cursor Y location. | |
Protected Member Functions | |
| 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 the PROGMEM- and RAM-resident getTextBounds() functions. | |
Protected Attributes | |
| int16_t | WIDTH |
| This is the 'raw' display width - never changes. | |
| int16_t | HEIGHT |
| This is the 'raw' display height - never changes. | |
| int16_t | _width |
| Display width as modified by current rotation. | |
| int16_t | _height |
| Display height as modified by current rotation. | |
| int16_t | cursor_x |
| x location to start print()ing text | |
| int16_t | cursor_y |
| y location to start print()ing text | |
| uint16_t | textcolor |
| 16-bit background color for print() | |
| uint16_t | textbgcolor |
| 16-bit text color for print() | |
| uint8_t | textsize_x |
| Desired magnification in X-axis of text to print() | |
| uint8_t | textsize_y |
| Desired magnification in Y-axis of text to print() | |
| uint8_t | rotation |
| Display rotation (0 thru 3) | |
| bool | wrap |
| If set, 'wrap' text at right edge of display. | |
| bool | _cp437 |
| If set, use correct CP437 charset (default is off) | |
| GFXfont * | gfxFont |
| Pointer to special font. | |
Detailed Description
A generic graphics superclass that can handle all sorts of drawing.
At a minimum you can subclass and provide drawPixel(). At a maximum you can do a ton of overriding to optimize. Used for any/all Adafruit displays!
Definition at line 15 of file Adafruit_GFX.h.
Constructor & Destructor Documentation
| Adafruit_GFX | ( | int16_t | w, |
| int16_t | h | ||
| ) |
Instatiate a GFX context for graphics! Can only be done by a superclass.
- Parameters:
-
w Display width, in pixels h Display height, in pixels
Definition at line 110 of file Adafruit_GFX.cpp.
Member Function Documentation
| void charBounds | ( | unsigned char | c, |
| int16_t * | x, | ||
| int16_t * | y, | ||
| int16_t * | minx, | ||
| int16_t * | miny, | ||
| int16_t * | maxx, | ||
| int16_t * | maxy | ||
| ) | [protected] |
Helper to determine size of a character with current font/size. Broke this out as it's used by both the PROGMEM- and RAM-resident getTextBounds() functions.
- Parameters:
-
c The ASCII character in question x Pointer to x location of character. Value is modified by this function to advance to next character. y Pointer to y location of character. Value is modified by this function to advance to next character. minx Pointer to minimum X coordinate, passed in to AND returned by this function -- this is used to incrementally build a bounding rectangle for a string. miny Pointer to minimum Y coord, passed in AND returned. maxx Pointer to maximum X coord, passed in AND returned. maxy Pointer to maximum Y coord, passed in AND returned.
Definition at line 1371 of file Adafruit_GFX.cpp.
| 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 'light shade' 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 'wrong' behavior and old sketches will still work. Pass 'true' to this function to use correct CP437 character values in your code.
- Parameters:
-
x true = enable (new behavior), false = disable (old behavior)
Definition at line 178 of file Adafruit_GFX.h.
| void drawBitmap | ( | int16_t | x, |
| int16_t | y, | ||
| const uint8_t | bitmap[], | ||
| int16_t | w, | ||
| int16_t | h, | ||
| uint16_t | color, | ||
| uint16_t | bg | ||
| ) |
Draw a PROGMEM-resident 1-bit image at the specified (x,y) position, using the specified foreground (for set bits) and background (unset bits) colors.
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate bitmap byte array with monochrome bitmap w Width of bitmap in pixels h Height of bitmap in pixels color 16-bit 5-6-5 Color to draw pixels with bg 16-bit 5-6-5 Color to draw background with
Definition at line 751 of file Adafruit_GFX.cpp.
| void drawBitmap | ( | int16_t | x, |
| int16_t | y, | ||
| uint8_t * | bitmap, | ||
| int16_t | w, | ||
| int16_t | h, | ||
| uint16_t | color | ||
| ) |
Draw a RAM-resident 1-bit image at the specified (x,y) position, using the specified foreground color (unset bits are transparent).
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate bitmap byte array with monochrome bitmap w Width of bitmap in pixels h Height of bitmap in pixels color 16-bit 5-6-5 Color to draw with
Definition at line 783 of file Adafruit_GFX.cpp.
| 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 color (unset bits are transparent).
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate bitmap byte array with monochrome bitmap w Width of bitmap in pixels h Height of bitmap in pixels color 16-bit 5-6-5 Color to draw with
Definition at line 717 of file Adafruit_GFX.cpp.
| void drawBitmap | ( | int16_t | x, |
| int16_t | y, | ||
| uint8_t * | bitmap, | ||
| int16_t | w, | ||
| int16_t | h, | ||
| uint16_t | color, | ||
| uint16_t | bg | ||
| ) |
Draw a RAM-resident 1-bit image at the specified (x,y) position, using the specified foreground (for set bits) and background (unset bits) colors.
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate bitmap byte array with monochrome bitmap w Width of bitmap in pixels h Height of bitmap in pixels color 16-bit 5-6-5 Color to draw pixels with bg 16-bit 5-6-5 Color to draw background with
Definition at line 817 of file Adafruit_GFX.cpp.
| void drawChar | ( | int16_t | x, |
| int16_t | y, | ||
| unsigned char | c, | ||
| uint16_t | color, | ||
| uint16_t | bg, | ||
| uint8_t | size | ||
| ) |
Draw a single character.
- Parameters:
-
x Bottom left corner x coordinate y Bottom left corner y coordinate c The 8-bit font-indexed character (likely ascii) color 16-bit 5-6-5 Color to draw chraracter with bg 16-bit 5-6-5 Color to fill background with (if same as color, no background) size Font magnification level, 1 is 'original' size
Definition at line 1115 of file Adafruit_GFX.cpp.
| void drawChar | ( | int16_t | x, |
| int16_t | y, | ||
| unsigned char | c, | ||
| uint16_t | color, | ||
| uint16_t | bg, | ||
| uint8_t | size_x, | ||
| uint8_t | size_y | ||
| ) |
Draw a single character.
- Parameters:
-
x Bottom left corner x coordinate y Bottom left corner y coordinate c The 8-bit font-indexed character (likely ascii) color 16-bit 5-6-5 Color to draw chraracter with bg 16-bit 5-6-5 Color to fill background with (if same as color, no background) size_x Font magnification level in X-axis, 1 is 'original' size size_y Font magnification level in Y-axis, 1 is 'original' size
Definition at line 1134 of file Adafruit_GFX.cpp.
| void drawCircle | ( | int16_t | x0, |
| int16_t | y0, | ||
| int16_t | r, | ||
| uint16_t | color | ||
| ) |
Draw a circle outline.
- Parameters:
-
x0 Center-point x coordinate y0 Center-point y coordinate r Radius of circle color 16-bit 5-6-5 Color to draw with
Definition at line 357 of file Adafruit_GFX.cpp.
| 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.
- Parameters:
-
x0 Center-point x coordinate y0 Center-point y coordinate r Radius of circle cornername Mask bit #1 or bit #2 to indicate which quarters of the circle we're doing color 16-bit 5-6-5 Color to draw with
Definition at line 407 of file Adafruit_GFX.cpp.
| void drawFastHLine | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | w, | ||
| uint16_t | color | ||
| ) | [virtual] |
Draw a perfectly horizontal line (this is often optimized in a subclass!)
- Parameters:
-
x Left-most x coordinate y Left-most y coordinate w Width in pixels color 16-bit 5-6-5 Color to fill with
Reimplemented in GFXcanvas1, GFXcanvas8, and GFXcanvas16.
Definition at line 282 of file Adafruit_GFX.cpp.
| void drawFastVLine | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | h, | ||
| uint16_t | color | ||
| ) | [virtual] |
Draw a perfectly vertical line (this is often optimized in a subclass!)
- Parameters:
-
x Top-most x coordinate y Top-most y coordinate h Height in pixels color 16-bit 5-6-5 Color to fill with
Reimplemented in GFXcanvas1, GFXcanvas8, and GFXcanvas16.
Definition at line 265 of file Adafruit_GFX.cpp.
| void drawGrayscaleBitmap | ( | int16_t | x, |
| int16_t | y, | ||
| const uint8_t | bitmap[], | ||
| const uint8_t | mask[], | ||
| int16_t | w, | ||
| int16_t | h | ||
| ) |
Draw a PROGMEM-resident 8-bit image (grayscale) with a 1-bit mask (set bits = opaque, unset bits = clear) at the specified (x,y) position. BOTH buffers (grayscale and mask) must be PROGMEM-resident. Specifically for 8-bit display devices such as IS31FL3731; no color reduction/expansion is performed.
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate bitmap byte array with grayscale bitmap mask byte array with mask bitmap w Width of bitmap in pixels h Height of bitmap in pixels
Definition at line 935 of file Adafruit_GFX.cpp.
| void drawGrayscaleBitmap | ( | int16_t | x, |
| int16_t | y, | ||
| uint8_t * | bitmap, | ||
| uint8_t * | mask, | ||
| int16_t | w, | ||
| int16_t | h | ||
| ) |
Draw a RAM-resident 8-bit image (grayscale) with a 1-bit mask (set bits = opaque, unset bits = clear) at the specified (x,y) position. BOTH buffers (grayscale and mask) must be RAM-residentt, no mix-and-match Specifically for 8-bit display devices such as IS31FL3731; no color reduction/expansion is performed.
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate bitmap byte array with grayscale bitmap mask byte array with mask bitmap w Width of bitmap in pixels h Height of bitmap in pixels
Definition at line 971 of file Adafruit_GFX.cpp.
| 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 display devices such as IS31FL3731; no color reduction/expansion is performed.
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate bitmap byte array with grayscale bitmap w Width of bitmap in pixels h Height of bitmap in pixels
Definition at line 885 of file Adafruit_GFX.cpp.
| void drawGrayscaleBitmap | ( | int16_t | x, |
| int16_t | y, | ||
| uint8_t * | bitmap, | ||
| int16_t | w, | ||
| int16_t | h | ||
| ) |
Draw a RAM-resident 8-bit image (grayscale) at the specified (x,y) pos. Specifically for 8-bit display devices such as IS31FL3731; no color reduction/expansion is performed.
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate bitmap byte array with grayscale bitmap w Width of bitmap in pixels h Height of bitmap in pixels
Definition at line 909 of file Adafruit_GFX.cpp.
| void drawLine | ( | int16_t | x0, |
| int16_t | y0, | ||
| int16_t | x1, | ||
| int16_t | y1, | ||
| uint16_t | color | ||
| ) | [virtual] |
Draw a line.
- Parameters:
-
x0 Start point x coordinate y0 Start point y coordinate x1 End point x coordinate y1 End point y coordinate color 16-bit 5-6-5 Color to draw with
Definition at line 330 of file Adafruit_GFX.cpp.
| virtual void drawPixel | ( | int16_t | x, |
| int16_t | y, | ||
| uint16_t | color | ||
| ) | [pure virtual] |
Draw to the screen/framebuffer/etc. Must be overridden in subclass.
- Parameters:
-
x X coordinate in pixels y Y coordinate in pixels color 16-bit pixel color.
Implemented in GFXcanvas1, GFXcanvas8, and GFXcanvas16.
| void drawRect | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | w, | ||
| int16_t | h, | ||
| uint16_t | color | ||
| ) | [virtual] |
Draw a rectangle with no fill color.
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate w Width in pixels h Height in pixels color 16-bit 5-6-5 Color to draw with
Definition at line 523 of file Adafruit_GFX.cpp.
| 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 devices; no color reduction performed.
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate bitmap byte array with 16-bit color bitmap w Width of bitmap in pixels h Height of bitmap in pixels
Definition at line 1001 of file Adafruit_GFX.cpp.
| void drawRGBBitmap | ( | int16_t | x, |
| int16_t | y, | ||
| uint16_t * | bitmap, | ||
| int16_t | w, | ||
| int16_t | h | ||
| ) |
Draw a RAM-resident 16-bit image (RGB 5/6/5) at the specified (x,y) position. For 16-bit display devices; no color reduction performed.
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate bitmap byte array with 16-bit color bitmap w Width of bitmap in pixels h Height of bitmap in pixels
Definition at line 1023 of file Adafruit_GFX.cpp.
| void drawRGBBitmap | ( | int16_t | x, |
| int16_t | y, | ||
| const uint16_t | bitmap[], | ||
| const uint8_t | mask[], | ||
| int16_t | w, | ||
| int16_t | h | ||
| ) |
Draw a PROGMEM-resident 16-bit image (RGB 5/6/5) with a 1-bit mask (set bits = opaque, unset bits = clear) at the specified (x,y) position. BOTH buffers (color and mask) must be PROGMEM-resident. For 16-bit display devices; no color reduction performed.
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate bitmap byte array with 16-bit color bitmap mask byte array with monochrome mask bitmap w Width of bitmap in pixels h Height of bitmap in pixels
Definition at line 1048 of file Adafruit_GFX.cpp.
| void drawRGBBitmap | ( | int16_t | x, |
| int16_t | y, | ||
| uint16_t * | bitmap, | ||
| uint8_t * | mask, | ||
| int16_t | w, | ||
| int16_t | h | ||
| ) |
Draw a RAM-resident 16-bit image (RGB 5/6/5) with a 1-bit mask (set bits = opaque, unset bits = clear) at the specified (x,y) position. BOTH buffers (color and mask) must be RAM-resident. For 16-bit display devices; no color reduction performed.
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate bitmap byte array with 16-bit color bitmap mask byte array with monochrome mask bitmap w Width of bitmap in pixels h Height of bitmap in pixels
Definition at line 1081 of file Adafruit_GFX.cpp.
| void drawRoundRect | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | w, | ||
| int16_t | h, | ||
| int16_t | r, | ||
| uint16_t | color | ||
| ) |
Draw a rounded rectangle with no fill color.
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate w Width in pixels h Height in pixels r Radius of corner rounding color 16-bit 5-6-5 Color to draw with
Definition at line 544 of file Adafruit_GFX.cpp.
| 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.
- Parameters:
-
x0 Vertex #0 x coordinate y0 Vertex #0 y coordinate x1 Vertex #1 x coordinate y1 Vertex #1 y coordinate x2 Vertex #2 x coordinate y2 Vertex #2 y coordinate color 16-bit 5-6-5 Color to draw with
Definition at line 600 of file Adafruit_GFX.cpp.
| 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 *.xbm, rename *.xbm to *.c and open in editor. C Array can be directly used with this function. There is no RAM-resident version of this function; if generating bitmaps in RAM, use the format defined by drawBitmap() and call that instead.
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate bitmap byte array with monochrome bitmap w Width of bitmap in pixels h Height of bitmap in pixels color 16-bit 5-6-5 Color to draw pixels with
Definition at line 851 of file Adafruit_GFX.cpp.
| void endWrite | ( | void | ) | [virtual] |
End a display-writing routine, overwrite in subclasses if startWrite is defined!
Definition at line 253 of file Adafruit_GFX.cpp.
| void fillCircle | ( | int16_t | x0, |
| int16_t | y0, | ||
| int16_t | r, | ||
| uint16_t | color | ||
| ) |
Draw a circle with filled color.
- Parameters:
-
x0 Center-point x coordinate y0 Center-point y coordinate r Radius of circle color 16-bit 5-6-5 Color to fill with
Definition at line 452 of file Adafruit_GFX.cpp.
| void fillCircleHelper | ( | int16_t | x0, |
| int16_t | y0, | ||
| int16_t | r, | ||
| uint8_t | corners, | ||
| int16_t | delta, | ||
| uint16_t | color | ||
| ) |
Quarter-circle drawer with fill, used for circles and roundrects.
- Parameters:
-
x0 Center-point x coordinate y0 Center-point y coordinate r Radius of circle corners Mask bits indicating which quarters we're doing delta Offset from center-point, used for round-rects color 16-bit 5-6-5 Color to fill with
Definition at line 471 of file Adafruit_GFX.cpp.
| void fillRect | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | w, | ||
| int16_t | h, | ||
| uint16_t | color | ||
| ) | [virtual] |
Fill a rectangle completely with one color. Update in subclasses if desired!
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate w Width in pixels h Height in pixels color 16-bit 5-6-5 Color to fill with
Definition at line 300 of file Adafruit_GFX.cpp.
| void fillRoundRect | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | w, | ||
| int16_t | h, | ||
| int16_t | r, | ||
| uint16_t | color | ||
| ) |
Draw a rounded rectangle with fill color.
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate w Width in pixels h Height in pixels r Radius of corner rounding color 16-bit 5-6-5 Color to draw/fill with
Definition at line 574 of file Adafruit_GFX.cpp.
| void fillScreen | ( | uint16_t | color ) | [virtual] |
Fill the screen completely with one color. Update in subclasses if desired!
- Parameters:
-
color 16-bit 5-6-5 Color to fill with
Reimplemented in GFXcanvas1, GFXcanvas8, and GFXcanvas16.
Definition at line 316 of file Adafruit_GFX.cpp.
| 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.
- Parameters:
-
x0 Vertex #0 x coordinate y0 Vertex #0 y coordinate x1 Vertex #1 x coordinate y1 Vertex #1 y coordinate x2 Vertex #2 x coordinate y2 Vertex #2 y coordinate color 16-bit 5-6-5 Color to fill/draw with
Definition at line 619 of file Adafruit_GFX.cpp.
| int16_t getCursorX | ( | void | ) | const |
Get text cursor X location.
- Returns:
- X coordinate in pixels
Definition at line 219 of file Adafruit_GFX.h.
| int16_t getCursorY | ( | void | ) | const |
Get text cursor Y location.
- Returns:
- Y coordinate in pixels
Definition at line 227 of file Adafruit_GFX.h.
| uint8_t getRotation | ( | void | ) | const |
Get rotation setting for display.
- Returns:
- 0 thru 3 corresponding to 4 cardinal rotations
Definition at line 209 of file Adafruit_GFX.h.
| void getTextBounds | ( | const char * | str, |
| 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, returns UL corner and W,H.
- Parameters:
-
str The ASCII string to measure x The current cursor X y The current cursor Y x1 The boundary X coordinate, returned by function y1 The boundary Y coordinate, returned by function w The boundary width, returned by function h The boundary height, returned by function
Definition at line 1448 of file Adafruit_GFX.cpp.
| int16_t height | ( | void | ) | const |
Get height of the display, accounting for current rotation.
- Returns:
- Height in pixels
Definition at line 201 of file Adafruit_GFX.h.
| void invertDisplay | ( | bool | i ) | [virtual] |
Invert the display (ideally using built-in hardware command)
- Parameters:
-
i True if you want to invert, false to make 'normal'
Definition at line 1542 of file Adafruit_GFX.cpp.
| void setCursor | ( | int16_t | x, |
| int16_t | y | ||
| ) |
Set text cursor location.
- Parameters:
-
x X coordinate in pixels y Y coordinate in pixels
Definition at line 128 of file Adafruit_GFX.h.
| void setFont | ( | const GFXfont * | f = NULL ) |
Set the font to display when print()ing, either custom or default.
- Parameters:
-
f The GFXfont object, if NULL use built in 6x8 font
Definition at line 1338 of file Adafruit_GFX.cpp.
| void setRotation | ( | uint8_t | x ) | [virtual] |
Set rotation setting for display.
- Parameters:
-
x 0 thru 3 corresponding to 4 cardinal rotations
Definition at line 1316 of file Adafruit_GFX.cpp.
| void setTextColor | ( | uint16_t | c ) |
Set text font color with transparant background.
- Parameters:
-
c 16-bit 5-6-5 Color to draw text with
- Note:
- For 'transparent' background, background and foreground are set to same color rather than using a separate flag.
Definition at line 141 of file Adafruit_GFX.h.
| void setTextColor | ( | uint16_t | c, |
| uint16_t | bg | ||
| ) |
Set text font color with custom background color.
- Parameters:
-
c 16-bit 5-6-5 Color to draw text with bg 16-bit 5-6-5 Color to draw background/fill with
Definition at line 150 of file Adafruit_GFX.h.
| void setTextSize | ( | uint8_t | s ) |
Set text 'magnification' size. Each increase in s makes 1 pixel that much bigger.
- Parameters:
-
s Desired text size. 1 is default 6x8, 2 is 12x16, 3 is 18x24, etc
Definition at line 1295 of file Adafruit_GFX.cpp.
| void setTextSize | ( | uint8_t | s_x, |
| uint8_t | s_y | ||
| ) |
Set text 'magnification' size. Each increase in s makes 1 pixel that much bigger.
- Parameters:
-
s_x Desired text width magnification level in X-axis. 1 is default s_y Desired text width magnification level in Y-axis. 1 is default
Definition at line 1305 of file Adafruit_GFX.cpp.
| void setTextWrap | ( | bool | w ) |
Set whether text that is too long for the screen width should automatically wrap around to the next line (else clip right).
- Parameters:
-
w true for wrapping, false for clipping
Definition at line 162 of file Adafruit_GFX.h.
| void startWrite | ( | void | ) | [virtual] |
Start a display-writing routine, overwrite in subclasses.
Definition at line 180 of file Adafruit_GFX.cpp.
| int16_t width | ( | void | ) | const |
Get width of the display, accounting for current rotation.
- Returns:
- Width in pixels
Definition at line 193 of file Adafruit_GFX.h.
| size_t write | ( | uint8_t | c ) | [virtual] |
Print one byte/character of data, used to support print()
- Parameters:
-
c The 8-bit ascii character to write
Definition at line 1242 of file Adafruit_GFX.cpp.
| void writeFastHLine | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | w, | ||
| uint16_t | color | ||
| ) | [virtual] |
Write a perfectly horizontal line, overwrite in subclasses if startWrite is defined!
- Parameters:
-
x Left-most x coordinate y Left-most y coordinate w Width in pixels color 16-bit 5-6-5 Color to fill with
Definition at line 222 of file Adafruit_GFX.cpp.
| void writeFastVLine | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | h, | ||
| uint16_t | color | ||
| ) | [virtual] |
Write a perfectly vertical line, overwrite in subclasses if startWrite is defined!
- Parameters:
-
x Top-most x coordinate y Top-most y coordinate h Height in pixels color 16-bit 5-6-5 Color to fill with
Definition at line 204 of file Adafruit_GFX.cpp.
| void writeFillRect | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | w, | ||
| int16_t | h, | ||
| uint16_t | color | ||
| ) | [virtual] |
Write a rectangle completely with one color, overwrite in subclasses if startWrite is defined!
- Parameters:
-
x Top left corner x coordinate y Top left corner y coordinate w Width in pixels h Height in pixels color 16-bit 5-6-5 Color to fill with
Definition at line 241 of file Adafruit_GFX.cpp.
| void writeLine | ( | int16_t | x0, |
| int16_t | y0, | ||
| int16_t | x1, | ||
| int16_t | y1, | ||
| uint16_t | color | ||
| ) | [virtual] |
Write a line. Bresenham's algorithm - thx wikpedia.
- Parameters:
-
x0 Start point x coordinate y0 Start point y coordinate x1 End point x coordinate y1 End point y coordinate color 16-bit 5-6-5 Color to draw with
Definition at line 132 of file Adafruit_GFX.cpp.
| void writePixel | ( | int16_t | x, |
| int16_t | y, | ||
| uint16_t | color | ||
| ) | [virtual] |
Write a pixel, overwrite in subclasses if startWrite is defined!
- Parameters:
-
x x coordinate y y coordinate color 16-bit 5-6-5 Color to fill with
Definition at line 190 of file Adafruit_GFX.cpp.
Field Documentation
bool _cp437 [protected] |
If set, use correct CP437 charset (default is off)
Definition at line 244 of file Adafruit_GFX.h.
int16_t _height [protected] |
Display height as modified by current rotation.
Definition at line 235 of file Adafruit_GFX.h.
int16_t _width [protected] |
Display width as modified by current rotation.
Definition at line 234 of file Adafruit_GFX.h.
int16_t cursor_x [protected] |
x location to start print()ing text
Definition at line 236 of file Adafruit_GFX.h.
int16_t cursor_y [protected] |
y location to start print()ing text
Definition at line 237 of file Adafruit_GFX.h.
Pointer to special font.
Definition at line 245 of file Adafruit_GFX.h.
int16_t HEIGHT [protected] |
This is the 'raw' display height - never changes.
Definition at line 233 of file Adafruit_GFX.h.
uint8_t rotation [protected] |
Display rotation (0 thru 3)
Definition at line 242 of file Adafruit_GFX.h.
uint16_t textbgcolor [protected] |
16-bit text color for print()
Definition at line 239 of file Adafruit_GFX.h.
uint16_t textcolor [protected] |
16-bit background color for print()
Definition at line 238 of file Adafruit_GFX.h.
uint8_t textsize_x [protected] |
Desired magnification in X-axis of text to print()
Definition at line 240 of file Adafruit_GFX.h.
uint8_t textsize_y [protected] |
Desired magnification in Y-axis of text to print()
Definition at line 241 of file Adafruit_GFX.h.
int16_t WIDTH [protected] |
This is the 'raw' display width - never changes.
Definition at line 232 of file Adafruit_GFX.h.
bool wrap [protected] |
If set, 'wrap' text at right edge of display.
Definition at line 243 of file Adafruit_GFX.h.
Generated on Tue Jul 12 2022 22:58:48 by
1.7.2