函数原型1:
void drawArc(int32_t x, int32_t y, int32_t r0, int32_t r1, float angle0, float angle1)
函数原型2:
void drawArc(int32_t x, int32_t y, int32_t r0, int32_t r1, float angle0, float angle1, const T &color)
功能说明:
传入参数:
返回值:
函数原型1:
void drawBezier( int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2, const T& color)
函数原型2:
void drawBezier( int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2)
函数原型3:
void drawBezier( int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x3, int32_t y3, const T& color)
函数原型4:
void drawBezier( int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x3, int32_t y3, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void drawCircle( int32_t x, int32_t y, int32_t r)
函数原型2:
void drawCircle( int32_t x, int32_t y, int32_t r, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void drawEllipse( int32_t x, int32_t y, int32_t rx, int32_t ry)
函数原型2:
void drawEllipse( int32_t x, int32_t y, int32_t rx, int32_t ry, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void drawEllipseArc( int32_t x, int32_t y, int32_t r0x, int32_t r1x, int32_t r0y, int32_t r1y, float angle0, float angle1)
函数原型2:
void drawEllipseArc( int32_t x, int32_t y, int32_t r0x, int32_t r1x, int32_t r0y, int32_t r1y, float angle0, float angle1, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void drawFastHLine( int32_t x, int32_t y, int32_t w)
函数原型2:
void drawFastHLine( int32_t x, int32_t y, int32_t w, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void drawFastVLine( int32_t x, int32_t y, int32_t w)
函数原型2:
void drawFastVLine( int32_t x, int32_t y, int32_t w, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void drawLine( int32_t x0, int32_t y0, int32_t x1, int32_t y1)
函数原型2:
void drawLine( int32_t x0, int32_t y0, int32_t x1, int32_t y1, const T& color)
功能说明:
传入参数:
返回值:
函数原型:
void drawGradientHLine( int32_t x, int32_t y, int32_t w, const T& colorstart, const T& colorend)
功能说明:
传入参数:
返回值:
函数原型:
void drawGradientLine ( int32_t x0, int32_t y0, int32_t x1, int32_t y1, const T& colorstart, const T& colorend )
功能说明:
传入参数:
返回值:
函数原型:
void drawGradientVLine( int32_t x, int32_t y, int32_t h, const T& colorstart, const T& colorend)
功能说明:
传入参数:
返回值:
函数原型1:
void drawPixel( int32_t x, int32_t y)
函数原型2:
void drawPixel( int32_t x, int32_t y, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void drawTriangle( int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2)
函数原型2:
void drawTriangle( int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void fillAffine(const float matrix[6], int32_t w, int32_t h)
函数原型2:
void fillAffine(const float matrix[6], int32_t w, int32_t h, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void fillArc( int32_t x, int32_t y, int32_t r0, int32_t r1, float angle0, float angle1)
函数原型2:
void fillArc( int32_t x, int32_t y, int32_t r0, int32_t r1, float angle0, float angle1, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void fillCircle( int32_t x, int32_t y, int32_t r)
函数原型2:
void fillCircle( int32_t x, int32_t y, int32_t r, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void fillEllipse( int32_t x, int32_t y, int32_t rx, int32_t ry)
函数原型2:
void fillEllipse( int32_t x, int32_t y, int32_t rx, int32_t ry, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void fillEllipseArc( int32_t x, int32_t y, int32_t r0x, int32_t r1x, int32_t r0y, int32_t r1y, float angle0, float angle1)
函数原型2:
void fillEllipseArc( int32_t x, int32_t y, int32_t r0x, int32_t r1x, int32_t r0y, int32_t r1y, float angle0, float angle1, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void fillRect( int32_t x, int32_t y, int32_t w, int32_t h)
函数原型2:
void fillRect( int32_t x, int32_t y, int32_t w, int32_t h, const T& color)
功能说明:
传入参数:
返回值:
函数原型:
void fillRectAlpha(int32_t x, int32_t y, int32_t w, int32_t h, uint8_t alpha, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void fillRoundRect( int32_t x, int32_t y, int32_t w, int32_t h, int32_t r)
函数原型2:
void fillRoundRect( int32_t x, int32_t y, int32_t w, int32_t h, int32_t r, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void fillTriangle( int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2)
函数原型2:
void fillTriangle( int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void floodFill( int32_t x, int32_t y)
函数原型2:
void floodFill( int32_t x, int32_t y, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void paint( int32_t x, int32_t y)
函数原型2:
void paint( int32_t x, int32_t y, const T& color)
功能说明:
传入参数:
返回值:
函数原型:
void copyRect(uint32_t dst_x, uint32_t dst_y, uint32_t w, uint32_t h, uint32_t src_x, uint32_t src_y)
功能说明:
传入参数:
返回值:
函数原型:
void progressBar(int x, int y, int w, int h, uint8_t val)
功能说明:
传入参数:
返回值:
函数原型:
void qrcode(const char *string, uint16_t x = 50, uint16_t y = 10, uint8_t width = 220, uint8_t version = 6)
void qrcode(const String &string, uint16_t x = 50, uint16_t y = 10, uint8_t width = 220, uint8_t version = 6)
功能说明:
传入参数:
返回值:
案例程序:
#include <Arduino.h>
#include <M5GFX.h>
#include <M5Unified.h>
M5GFX display;
void setup() {
display.begin();
display.setRotation(3);
display.clear(TFT_WHITE);
delay(1000);
uint16_t x = display.width() / 2;
uint16_t y = display.height() / 2;
display.drawArc(x, y, 100, 200, 0, 90, TFT_BLACK);
display.drawBezier(0, 0, x/2, 0, x/2, y/2, TFT_VIOLET);
display.drawBezier(0, 0, x/2, 0, x/2, y, 0, y, TFT_DARKGREEN);
display.drawCircle(x, y, 200, TFT_BLACK);
display.drawEllipse(x, y, 300, 200);
display.drawEllipseArc(x, y, 100, 200, 200, 300, 180, 270);
display.drawFastHLine(0, y/2, x);
display.drawFastVLine(x/2, 0, y);
display.drawLine(0, 0, x, y);
display.drawGradientHLine(x, y/2*3, x, TFT_BLUE, TFT_RED);
display.drawGradientVLine(x/2*3, y, y, TFT_BLUE, TFT_RED);
display.drawGradientLine(x, y, x*2, y*2, TFT_BLUE, TFT_RED);
display.drawTriangle(x/2, 0, x/4, y/2, x/2, y);
static float Affine_mat[9] = {1, 0, 0,
0, 1, y,
0, 0, 1 };
display.fillAffine(Affine_mat, x/4, y/4, TFT_RED);
display.fillArc(x, y, 100, 200, 90, 180, TFT_ORANGE);
display.fillCircle(x, y, 100, TFT_YELLOW);
display.fillEllipse(x, y, 100, 50, TFT_BLACK);
display.fillEllipseArc(x, y, 100, 200, 200, 300, 270, 360, TFT_SKYBLUE);
display.fillRect(x/4, y, x/4, y/4, TFT_PINK);
display.fillRectAlpha(x/4, y/4*5, x/4, y/4, 85, TFT_PINK);
display.fillRoundRect(0, y/4*5, x/4, y/4, 30, TFT_GREEN);
display.fillTriangle(0, 0, x/4, y/2, 0, y, TFT_BLUE);
display.progressBar(x, 0, x, 40, 66);
display.qrcode("Hello! This is M5Stack.", x/2*3, y/4, y/4*3);
delay(2000);
display.floodFill(x/4, y/2+10, TFT_MAGENTA);
display.paint(x/4, y/2-10, TFT_CYAN);
}
void loop() {
}
函数原型:
uint32_t getStartCount(void)
功能说明:
传入参数:
返回值:
函数原型:
uint16_t readPixel(int32_t x, int32_t y)
功能说明:
传入参数:
返回值:
函数原型:
RGBColor readPixelRGB(int32_t x, int32_t y)
功能说明:
传入参数:
返回值:
函数原型:
void readRect( int32_t x, int32_t y, int32_t w, int32_t h, T* data)
功能说明:
传入参数:
返回值:
函数原型:
void readRectRGB( int32_t x, int32_t y, int32_t w, int32_t h, RGBColor* data)
功能说明:
传入参数:
返回值:
函数原型:
void startWrite(bool transaction = true)
功能说明:
startWrite
可使 M5GFX 有效地利用 DMA 缓冲区。传入参数:
返回值:
函数原型:
void endWrite(void)
功能说明
传入参数:
返回值:
函数原型:
void pushBlock( const T& color, uint32_t length)
功能说明:
传入参数:
返回值:
函数原型1:
void pushPixels(T* data, int32_t len )
函数原型2:
void pushPixels(const uint16_t* data, int32_t len, bool swap)
void pushPixels(const void* data, int32_t len, bool swap)
功能说明:
传入参数:
返回值:
函数原型1:
void pushPixelsDMA(T* data, int32_t len )
函数原型2:
void pushPixelsDMA(const uint16_t* data, int32_t len, bool swap)
void pushPixelsDMA(const void* data, int32_t len, bool swap)
功能说明:
传入参数:
返回值:
函数原型:
void writeColor( const T& color, uint32_t length)
功能说明:
传入参数:
返回值:
函数原型1:
void writeFastHLine( int32_t x, int32_t y, int32_t w)
函数原型2:
void writeFastHLine( int32_t x, int32_t y, int32_t w, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void writeFastVLine( int32_t x, int32_t y, int32_t w)
函数原型2:
void writeFastVLine( int32_t x, int32_t y, int32_t w, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void writeFillRect( int32_t x, int32_t y, int32_t w, int32_t h)
函数原型2:
void writeFillRect( int32_t x, int32_t y, int32_t w, int32_t h, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void writeFillRectPreclipped( int32_t x, int32_t y, int32_t w, int32_t h)
函数原型2:
void writeFillRectPreclipped( int32_t x, int32_t y, int32_t w, int32_t h, const T& color)
功能说明:
传入参数:
返回值:
函数原型:
void writeIndexedPixels(const uint8_t* data, T* palette, int32_t len, uint8_t depth = 8)
功能说明:
传入参数:
返回值:
函数原型1:
void writePixel(int32_t x, int32_t y)
函数原型2:
void writePixel(int32_t x, int32_t y, const T& color)
功能说明:
传入参数:
返回值:
函数原型1:
void writePixels(const T* data, int32_t len)
函数原型2:
void writePixels(const uint16_t* data, int32_t len, bool swap)
void writePixels(const void* data, int32_t len, bool swap)
功能说明:
传入参数:
返回值:
函数原型1:
void writePixelsDMA(const T* data, int32_t len)
函数原型2:
void writePixelsDMA(const uint16_t* data, int32_t len, bool swap)
void writePixelsDMA(const void* data, int32_t len, bool swap)
功能说明:
传入参数:
返回值:
案例程序:
#include <Arduino.h>
#include <M5GFX.h>
#include <M5Unified.h>
M5GFX display;
const size_t data_len = 1320;
static uint16_t r_data;
RGBColor rgb_data;
void setup() {
display.begin();
display.setColorDepth(16);
display.setRotation(1);
display.clear(TFT_WHITE);
display.setTextFont(&fonts::FreeSansOblique12pt7b);
display.setTextColor(TFT_BLACK);
delay(500);
uint16_t x = display.width() / 2;
uint16_t y = display.height() / 2;
uint16_t w_data[data_len];
for(int i=0; i<data_len; i++)
{
w_data[i] = 0;//BLACK
}
display.drawCenterString("Write Read Test", x, y);
delay(1000);
display.startWrite(true);
display.writeFillRect(21, 21, 280, 10, TFT_RED);
display.writeFillRectPreclipped(31, 31, 260, 10, TFT_BLUE);
display.writeFastHLine(51, 51, 220, TFT_GREEN);
display.writeFastHLine(51, 190, 220, TFT_GREEN);
display.writeFastVLine(51, 51, 140, TFT_GREEN);
display.writeFastVLine(270, 51, 140, TFT_GREEN);
delay(500);
for(int i=41; i<=280; i++)
{
for(int j=41; j<=50; j++)
{
display.writePixel(i, j, TFT_GREEN);
}
}
display.setWindow(51, 51, 270, 190);
// By choosing to use the following code, you can clearly see the differences between setWindow and setAddrWindow.
// display.setAddrWindow(51,51,270,190);
display.pushBlock(TFT_ORANGE, data_len);
display.writePixels(w_data, data_len, 0);//Has the same effect as the following code
// display.pushPixels(w_data, data_len, 0);
// display.writePixelsDMA(w_data, data_len, 0);
delay(500);
display.writeColor(TFT_DARKGREEN, data_len);//660 indicates that three rows of pixels have been drawn within the specified rectangular area.
display.endWrite();
auto color_565 = display.readPixel(21, 21);
auto color_RGB = display.readPixelRGB(21, 21);
display.setTextFont(&fonts::Font0);
display.setCursor(21, 200);
display.printf("565code: %#X, R:%d, G:%d, B:%d\n", color_565, color_RGB.r, color_RGB.g, color_RGB.b);
display.readRect(25, 25, 1, 1, &r_data);
display.readRectRGB(25, 25, 1, 1, &rgb_data);
display.setCursor(21, 215);
display.printf("888code: %#X\n", &r_data);
display.setCursor(75, 230);
display.printf("R:%d, G:%d, B:%d", &rgb_data.r, &rgb_data.g, &rgb_data.b);
}
void loop() {
}