Nol.A SDK Library 26.11.2
For IoT System Software Development
Loading...
Searching...
No Matches
Adafruit_GFX Class Referenceabstract

Device-independent drawing and text interface derived from Print. More...

#include <Adafruit_GFX.hpp>

Inheritance diagram for Adafruit_GFX:
Print Adafruit_SSD1306 Dogm128_6 GFXcanvas1 GFXcanvas16 GFXcanvas8 ST7920 KXM12864M_3

Public Member Functions

 Adafruit_GFX (int16_t w, int16_t h)
 Construct a graphics surface with native width w and height h in pixels. Coordinates use pixels from the upper-left corner; colors are interpreted by the concrete display. Subclasses must implement drawPixel().
virtual void drawPixel (int16_t x, int16_t y, uint16_t color)=0
 Draw one pixel at x/y using the device-specific color value. Canvas overrides update RAM.
virtual void writeFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 Write a vertical line of h pixels at x/y using color.
virtual void writeFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color)
 Write a horizontal line of w pixels at x/y using color.
virtual void writeLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 Write a line between the inclusive endpoints (x0,y0) and (x1,y1).
virtual void setRotation (uint8_t r)
 Select orientation using the low two bits of r (0, 90, 180, or 270 degrees).
virtual void invertDisplay (boolean i)
 Request device inversion when i is true; the base implementation is a no-op.
virtual void drawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 Draw a vertical line of h pixels at x/y with the current display orientation.
virtual void drawFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color)
 Draw a horizontal line of w pixels at x/y with the current display orientation.
virtual void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 Fill a rectangle at x/y of width w and height h in pixels.
virtual void fillScreen (uint16_t color)
 Fill the entire graphics surface with color.
virtual void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 Draw a line between the inclusive endpoints (x0,y0) and (x1,y1).
virtual void drawRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 Draw the outline of a rectangle at x/y of width w and height h in pixels.
virtual size_t write (uint8_t)
 Render one character at the text cursor, honoring font, scale, wrapping, and colors.
void drawCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 Draw a circle outline centered at x0/y0 with radius r in pixels.
void drawCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color)
 Draw selected circle quadrants; cornername is the four-bit quadrant mask.
void fillCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 Fill a circle centered at x0/y0 with radius r in pixels.
void fillCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color)
 Fill selected circle sides; cornername selects sides and delta extends vertical spans.
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 outline through the three supplied pixel-coordinate vertices.
void fillTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 Fill a triangle through the three supplied pixel-coordinate vertices.
void drawRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
 Draw a rectangle outline at x0/y0 with pixel dimensions w/h and corner radius.
void fillRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
 Fill a rectangle at x0/y0 with pixel dimensions w/h and corner radius.
void drawBitmap (int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color)
 Draw a row-padded, MSB-first 1-bit bitmap of w by h pixels at x/y. Set bits use color; clear bits are transparent unless the bg overload is used.
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 row-padded, MSB-first 1-bit bitmap of w by h pixels at x/y. Set bits use color; clear bits are transparent unless the bg overload is used.
void drawBitmap (int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)
 Draw a row-padded, MSB-first 1-bit bitmap of w by h pixels at x/y. Set bits use color; clear bits are transparent unless the bg overload is used.
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 row-padded, MSB-first 1-bit bitmap of w by h pixels at x/y. Set bits use color; clear bits are transparent unless the bg overload is used.
void drawXBitmap (int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color)
 Draw an LSB-first XBM image of w by h pixels; zero bits are transparent.
void drawGrayscaleBitmap (int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h)
 Draw w by h bytes of grayscale pixels at x/y. Mask overloads use an MSB-first 1-bit mask; zero mask bits are transparent.
void drawGrayscaleBitmap (int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h)
 Draw w by h bytes of grayscale pixels at x/y. Mask overloads use an MSB-first 1-bit mask; zero mask bits are transparent.
void drawGrayscaleBitmap (int16_t x, int16_t y, const uint8_t bitmap[], const uint8_t mask[], int16_t w, int16_t h)
 Draw w by h bytes of grayscale pixels at x/y. Mask overloads use an MSB-first 1-bit mask; zero mask bits are transparent.
void drawGrayscaleBitmap (int16_t x, int16_t y, uint8_t *bitmap, uint8_t *mask, int16_t w, int16_t h)
 Draw w by h bytes of grayscale pixels at x/y. Mask overloads use an MSB-first 1-bit mask; zero mask bits are transparent.
void drawRGBBitmap (int16_t x, int16_t y, const uint16_t bitmap[], int16_t w, int16_t h)
 Draw w by h RGB565 pixels at x/y. Mask overloads use an MSB-first 1-bit mask; zero mask bits are transparent.
void drawRGBBitmap (int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h)
 Draw w by h RGB565 pixels at x/y. Mask overloads use an MSB-first 1-bit mask; zero mask bits are transparent.
void drawRGBBitmap (int16_t x, int16_t y, const uint16_t bitmap[], const uint8_t mask[], int16_t w, int16_t h)
 Draw w by h RGB565 pixels at x/y. Mask overloads use an MSB-first 1-bit mask; zero mask bits are transparent.
void drawRGBBitmap (int16_t x, int16_t y, uint16_t *bitmap, uint8_t *mask, int16_t w, int16_t h)
 Draw w by h RGB565 pixels at x/y. Mask overloads use an MSB-first 1-bit mask; zero mask bits are transparent.
void drawChar (int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size)
 Draw character c at x/y with foreground/background colors and integer pixel scale.
void setCursor (int16_t x, int16_t y)
 Set the text cursor in pixels; custom-font y coordinates refer to the baseline.
void setTextColor (uint16_t c)
 Set text foreground color; the two-argument overload also sets background. The one-argument overload uses transparent background for the classic font.
void setTextColor (uint16_t c, uint16_t bg)
 Set text foreground color; the two-argument overload also sets background. The one-argument overload uses transparent background for the classic font.
void setTextSize (uint8_t s)
 Set integer text magnification; zero is treated as one.
void setTextWrap (boolean w)
 Enable or disable automatic text wrapping at the right edge.
void cp437 (boolean x=true)
 Enable corrected CP437 character mapping; false retains the legacy mapping.
void setFont (const GFXfont *f=NULL)
 Select a borrowed GFXfont; nullptr restores the built-in fixed-width font.
int16_t height (void) const
 Return the surface height in pixels after rotation.
int16_t width (void) const
 Return the surface width in pixels after rotation.
uint8_t getRotation (void) const
 Return the current rotation index, 0 through 3.
int16_t getCursorX (void) const
 Return the text cursor X coordinate in pixels.
int16_t getCursorY (void) const
 Return the text cursor Y coordinate in pixels.
Public Member Functions inherited from Print
int getWriteError ()
void clearWriteError ()
size_t write (const char *str)
 문자열을 출력합니다.
virtual size_t write (const uint8_t *buffer, size_t size)
 데이터 배열을 출력합니다.
size_t write (const char *buffer, size_t size)
 데이터 배열을 출력합니다.
virtual int availableForWrite ()
size_t print (const __FlashStringHelper *)
 프로그램 메모리(읽기 전용 플래시) 영역에 저장된 문자열을 출력합니다.
size_t print (const std::string &)
 문자열을 출력합니다.
size_t print (const char[])
 NULL로 종료되는 문자열을 출력합니다.
size_t print (char)
 문자 하나를 출력합니다.
size_t print (unsigned char, int=DEC)
 부호가 없는(unsigned) 8-byte 정수를 지정한 진수 형태로 출력합니다.
size_t print (int, int=DEC)
 int 형 정수를 지정한 진수 형태로 출력합니다.
size_t print (unsigned int, int=DEC)
 unsigned int 형 정수를 지정한 진수 형태로 출력합니다.
size_t print (long, int=DEC)
 long 형 정수를 지정한 진수 형태로 출력합니다.
size_t print (unsigned long, int=DEC)
 unsigned long 형 정수를 지정한 진수 형태로 출력합니다.
size_t print (double, int=2)
 double 형 실수를 지정한 소수점 이하 출력 개수로 출력합니다.
size_t print (const Printable &)
 Printable을 구현한 클래스를 출력합니다.
size_t println (const __FlashStringHelper *)
 프로그램 메모리(읽기 전용 플래시) 영역에 저장된 문자열과 개행문자(CR+LF)를 출력합니다.
size_t println (const std::string &s)
 문자열과 개행문자(CR+LF)를 출력합니다.
size_t println (const char[])
 NULL로 종료되는 문자열과 개행문자(CR+LF)를 출력합니다.
size_t println (char)
 문자 하나와 개행문자(CR+LF)를 출력합니다.
size_t println (unsigned char, int=DEC)
 부호가 없는(unsigned) 8-byte 정수를 지정한 진수 형태로, 개행문자(CR+LF)와 함께 출력합니다.
size_t println (int, int=DEC)
 int 형 정수를 지정한 진수 형태로, 개행문자(CR+LF)와 함께 출력합니다.
size_t println (unsigned int, int=DEC)
 unsigned int 형 정수를 지정한 진수 형태로, 개행문자(CR+LF)와 함께 출력합니다.
size_t println (long, int=DEC)
 long 형 정수를 지정한 진수 형태로, 개행문자(CR+LF)와 함께 출력합니다.
size_t println (unsigned long, int=DEC)
 unsigned long 형 정수를 지정한 진수 형태로, 개행문자(CR+LF)와 함께 출력합니다.
size_t println (double, int=2)
 double 형 실수를 지정한 소수점 이하 출력 개수로, 개행문자(CR+LF)와 함께 출력합니다.
size_t println (const Printable &)
 Printable을 구현한 클래스를, 개행문자(CR+LF)와 함께 출력합니다.
size_t println (void)
 개행문자(CR+LF)를 출력합니다.
virtual int printf (const char *,...)
 printf 출력을 내보냅니다.
virtual void flush ()

Protected Member Functions

void charBounds (char c, int16_t *x, int16_t *y, int16_t *minx, int16_t *miny, int16_t *maxx, int16_t *maxy)
Protected Member Functions inherited from Print
void setWriteError (int err=1)

Protected Attributes

const int16_t WIDTH
const int16_t HEIGHT
int16_t _width
int16_t _height
int16_t cursor_x
int16_t cursor_y
uint16_t textcolor
uint16_t textbgcolor
uint8_t textsize
uint8_t rotation
boolean wrap
boolean _cp437
const GFXfont * gfxFont

Detailed Description

Device-independent drawing and text interface derived from Print.

Member Function Documentation

◆ drawFastVLine()

virtual void Adafruit_GFX::drawFastVLine ( int16_t x,
int16_t y,
int16_t h,
uint16_t color )
virtual

Draw a vertical line of h pixels at x/y with the current display orientation.

Reimplemented in Adafruit_SSD1306, and Dogm128_6.

◆ drawPixel()

virtual void Adafruit_GFX::drawPixel ( int16_t x,
int16_t y,
uint16_t color )
pure virtual

Draw one pixel at x/y using the device-specific color value. Canvas overrides update RAM.

Implemented in Adafruit_SSD1306, Dogm128_6, GFXcanvas16, GFXcanvas1, GFXcanvas8, and ST7920.

◆ invertDisplay()

virtual void Adafruit_GFX::invertDisplay ( boolean i)
virtual

Request device inversion when i is true; the base implementation is a no-op.

Reimplemented in Adafruit_SSD1306.

◆ write()

virtual size_t Adafruit_GFX::write ( uint8_t )
virtual

Render one character at the text cursor, honoring font, scale, wrapping, and colors.

Returns
One byte consumed; inherited Print helpers can write strings and numbers.

Implements Print.

◆ writeFastHLine()

virtual void Adafruit_GFX::writeFastHLine ( int16_t x,
int16_t y,
int16_t w,
uint16_t color )
virtual

Write a horizontal line of w pixels at x/y using color.

Reimplemented in GFXcanvas8.


The documentation for this class was generated from the following file: