🚀
头像

默永


人生就像骑单车,想保持平衡就得往前走。

esp8266 tft库中的函数翻译

2022-12-09 18:14:05 253 💗 0 @默永

TFT_eSPI.h

drawPixel(int32_t x, int32_t y, uint32_t color), // 绘制图像
drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32_t bg, uint8_t size), // 绘制图表
drawLine(int32_t xs, int32_t ys, int32_t xe, int32_t ye, uint32_t color), // 画线
drawFastVLine(int32_t x, int32_t y, int32_t h, uint32_t color), // 竖线
drawFastHLine(int32_t x, int32_t y, int32_t w, uint32_t color), // 横线
fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color); // 填充矩形
drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t font), // 绘制图表
drawChar(uint16_t uniCode, int32_t x, int32_t y),
height(void),
width(void);
// Read the colour of a pixel at x,y and return value in 565 format
readPixel(int32_t x, int32_t y); // 读取x、y像素的颜色,并以565格式返回值
setWindow(int32_t xs, int32_t ys, int32_t xe, int32_t ye);   // Note: start + end coordinates 设置窗口
// Push (aka write pixel) colours to the set window
pushColor(uint16_t color); // 推送颜色
// These are non-inlined to enable override
begin_nin_write(); // 开始写入
end_nin_write(); // 结束_写入
setRotation(uint8_t r); // Set the display image orientation to 0, 1, 2 or 3 将显示图像方向设置为0、1、2或3
getRotation(void);      // Read the current rotation 读取当前旋转
invertDisplay(bool i);  // Tell TFT to invert all displayed colours 告诉TFT反转所有显示的颜色
setAddrWindow(int32_t xs, int32_t ys, int32_t w, int32_t h); // Note: start coordinates + width and height 注:起始坐标+宽度和高度
setViewport(int32_t x, int32_t y, int32_t w, int32_t h, bool vpDatum = true); // 设置视口
checkViewport(int32_t x, int32_t y, int32_t w, int32_t h); // 检查视口
getViewportX(void); // 获取视口X
getViewportY(void); //获取视口Y
getViewportWidth(void); // 获取视口宽度
getViewportHeight(void); // 获取视口高度
getViewportDatum(void); // 获取视口基准
frameViewport(uint16_t color, int32_t w); // 框架视口
resetViewport(void); // 重置视口
// Clip input window to viewport bounds, return false if whole area is out of bounds
// 将输入窗口剪裁到视口边界,如果整个区域超出边界,则返回false
clipAddrWindow(int32_t* x, int32_t* y, int32_t* w, int32_t* h); // 夹子地址窗口
// Clip input window area to viewport bounds, return false if whole area is out of bounds
// 将输入窗口区域剪裁到视口边界,如果整个区域超出边界,则返回false
clipWindow(int32_t* xs, int32_t* ys, int32_t* xe, int32_t* ye); // 剪辑窗口
// Push (aka write pixel) colours to the TFT (use setAddrWindow() first)
// 将(也称为写入像素)颜色推送到TFT(首先使用setAddrWindow())
pushColor(uint16_t color, uint32_t len),  // Deprecated, use pushBlock() 推送颜色
pushColors(uint16_t  *data, uint32_t len, bool swap = true), // With byte swap option 带字节交换选项
pushColors(uint8_t  *data, uint32_t len); // Deprecated, use pushPixels()
// Write a solid block of a single colour
pushBlock(uint16_t color, uint32_t len); // 写一个单色的实心块 按钮块
// Write a set of pixels stored in memory, use setSwapBytes(true/false) function to correct endianess
// 写一组存储在内存中的像素,使用setSwapBytes(true/false)函数来纠正字节数
pushPixels(const void * data_in, uint32_t len); // 推动像素
// Graphics drawing 图形绘制
fillScreen(uint32_t color), // 填充屏幕
drawRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color), // 画矩形
drawRoundRect(int32_t x, int32_t y, int32_t w, int32_t h, int32_t radius, uint32_t color), // 绘图圆角
fillRoundRect(int32_t x, int32_t y, int32_t w, int32_t h, int32_t radius, uint32_t color); // 填充圆形区域
fillRectVGradient(int16_t x, int16_t y, int16_t w, int16_t h, uint32_t color1, uint32_t color2); // 填充矩形
fillRectHGradient(int16_t x, int16_t y, int16_t w, int16_t h, uint32_t color1, uint32_t color2); // 填充矩形
// Draw a pixel blended with the pixel colour on the TFT or sprite, return blended colour
// If bg_color is not included the background pixel colour will be read from TFT or sprite
//在TFT或精灵上绘制与像素颜色混合的像素,返回混合颜色
//如果不包含bg_color,背景像素颜色将从TFT或精灵中读取
drawPixel(int32_t x, int32_t y, uint32_t color, uint8_t alpha, uint32_t bg_color = 0x00FFFFFF); // 绘图像素
// Draw a **all anti-aliased filled circle at ax,ay with radius r (uses drawWideLine)
// If bg_color is not included the background pixel colour will be read from TFT or sprite
//在ax,ay处绘制一个半径为r的小反锯齿填充圆(使用drawWideLine)
//如果不包含bg_color,背景像素颜色将从TFT或精灵中读取
drawSpot(float ax, float ay, float r, uint32_t fg_color, uint32_t bg_color = 0x00FFFFFF); // 绘图点
// Draw an anti-aliased filled circle at x, y with radius r
// If bg_color is not included the background pixel colour will be read from TFT or sprite
//在x,y处绘制半径为r的反锯齿实心圆
//如果不包含bg_color,背景像素颜色将从TFT或精灵中读取
fillSmoothCircle(int32_t x, int32_t y, int32_t r, uint32_t color, uint32_t bg_color = 0x00FFFFFF); // 填充平滑圆
// 填充光滑圆角
fillSmoothRoundRect(int32_t x, int32_t y, int32_t w, int32_t h, int32_t radius, uint32_t color, uint32_t bg_color = 0x00FFFFFF);
// Draw an anti-aliased wide line from ax,ay to bx,by width wd with radiused ends (radius is wd/2)
// If bg_color is not included the background pixel colour will be read from TFT or sprite
//绘制一条从ax,ay到bx的反锯齿宽线,宽度为wd,末端为圆角(半径为wd/2)
//如果不包含bg_color,背景像素颜色将从TFT或精灵中读取
drawWideLine(float ax, float ay, float bx, float by, float wd, uint32_t fg_color, uint32_t bg_color = 0x00FFFFFF); // 绘制宽线
// Draw an anti-aliased wide line from ax,ay to bx,by with different width at each end aw, bw and with radiused ends
// If bg_color is not included the background pixel colour will be read from TFT or sprite
//绘制一条从ax,ay到bx的抗锯齿宽线,在每个端点aw,bw处具有不同的宽度,并具有圆角端点
//如果不包含bg_color,背景像素颜色将从TFT或精灵中读取   绘制边缘线
drawWedgeLine(float ax, float ay, float bx, float by, float aw, float bw, uint32_t fg_color, uint32_t bg_color = 0x00FFFFFF);
drawCircle(int32_t x, int32_t y, int32_t r, uint32_t color), // 绘制圆圈
drawCircleHelper(int32_t x, int32_t y, int32_t r, uint8_t cornername, uint32_t color), // 画圈助手
fillCircle(int32_t x, int32_t y, int32_t r, uint32_t color), // 填充圆
fillCircleHelper(int32_t x, int32_t y, int32_t r, uint8_t cornername, int32_t delta, uint32_t color), // 填充圆助手
drawEllipse(int16_t x, int16_t y, int32_t rx, int32_t ry, uint16_t color), // 绘制椭圆
fillEllipse(int16_t x, int16_t y, int32_t rx, int32_t ry, uint16_t color), // 填充椭圆
//                 Corner 1               Corner 2               Corner 3
drawTriangle(int32_t x1,int32_t y1, int32_t x2,int32_t y2, int32_t x3,int32_t y3, uint32_t color), // 绘制三角形
fillTriangle(int32_t x1,int32_t y1, int32_t x2,int32_t y2, int32_t x3,int32_t y3, uint32_t color); // 填充三角形
//交换pushImage()和pushPixels()的字节顺序-纠正尾数
setSwapBytes(bool swap); // 设置交换字节
getSwapBytes(void); // 获取交换字节
// Draw bitmap 绘制位图
drawBitmap( int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t fgcolor), // 绘制位图
drawBitmap( int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t fgcolor, uint16_t bgcolor),
drawXBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t fgcolor),
drawXBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t fgcolor, uint16_t bgcolor),
setBitmapColor(uint16_t fgcolor, uint16_t bgcolor); // Define the 2 colours for 1bpp sprites
// Set TFT pivot point (use when rendering rotated sprites)
//设置TFT枢轴点(渲染旋转的子画面时使用)
setPivot(int16_t x, int16_t y); // 设置枢轴
getPivotX(void), // Get pivot x
getPivotY(void); // Get pivot y
// The next functions can be used as a pair to copy screen blocks (or horizontal/vertical lines) to another location
// Read a block of pixels to a data buffer, buffer is 16 bit and the size must be at least w * h
//下一个函数可以成对使用,将屏幕块(或水平/垂直线)复制到另一个位置
//将像素块读取到数据缓冲区,缓冲区为16位,大小必须至少为w*h
readRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *data); // 读取矩形
// Write a block of pixels to the screen which have been read by readRect()
//将一块像素写入屏幕,这些像素已被readRect()读取
pushRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *data);
// These are used to render images or sprites stored in RAM arrays (used by Sprite class for 16bpp Sprites)
//这些用于渲染存储在RAM阵列中的图像或精灵(由精灵类用于16bpp精灵)
pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *data); // 推送图像
pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *data, uint16_t transparent); // 推送图像
// These are used to render images stored in FLASH (PROGMEM)
//用于渲染Flash中存储的图像(PROGMEM)
pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const uint16_t *data, uint16_t transparent);
pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const uint16_t *data);
// These are used by Sprite class pushSprite() member function for 1, 4 and 8 bits per pixel (bpp) colours
// They are not intended to be used with user sketches (but could be)
// Set bpp8 true for 8bpp sprites, false otherwise. The cmap pointer must be specified for 4bpp
//它们由Sprite类Push Sprite()成员函数用于1、4和8位/像素(BPP)颜色。
//它们不用于用户草图(但也可以)。
//对于8bpp精灵,设置bpp8为真,否则设置为假。必须为4bpp指定cmap指针
pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint8_t  *data, bool bpp8 = true, uint16_t *cmap = nullptr);
pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint8_t  *data, uint8_t  transparent, bool bpp8 = true, uint16_t *cmap = nullptr);
// FLASH version
//Flash版本
pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const uint8_t *data, bool bpp8,  uint16_t *cmap = nullptr);
// This next function has been used successfully to dump the TFT screen to a PC for documentation purposes
// It reads a screen area and returns the 3 RGB 8 bit colour values of each pixel in the buffer
// Set w and h to 1 to read 1 pixel's colour. The data buffer must be at least w * h * 3 bytes
//下一个函数已成功用于将TFT屏幕转储到PC上以用于文档编制。
//读取屏幕区域,返回缓冲区中每个像素的3 RGB 8位颜色值。
//将w和h设置为1以读取1个像素的颜色。数据缓冲区必须至少为w*h*3个字节
readRectRGB(int32_t x, int32_t y, int32_t w, int32_t h, uint8_t *data); // 读取正方形RGB
drawNumber(long intNumber, int32_t x, int32_t y, uint8_t font), // Draw integer using specified font number 使用指定的字体号绘制整数
drawNumber(long intNumber, int32_t x, int32_t y),               // Draw integer using current font 使用当前字体绘制整数
// Decimal is the number of decimal places to render
// Use with setTextDatum() to position values on TFT, and setTextPadding() to blank old displayed values
drawFloat(float floatNumber, uint8_t decimal, int32_t x, int32_t y, uint8_t font), // Draw float using specified font number
drawFloat(float floatNumber, uint8_t decimal, int32_t x, int32_t y),               // Draw float using current font
// Handle char arrays
// Use with setTextDatum() to position string on TFT, and setTextPadding() to blank old displayed strings
//Decimal是要呈现的小数位数。
//与setTextDatum()配合使用,用于在TFT上定位值,与setTextPending()配合使用,用于清空旧显示的值
drawString(const char *string, int32_t x, int32_t y, uint8_t font),  // Draw string using specified font number 使用指定的字体编号绘制字符串
drawString(const char *string, int32_t x, int32_t y),                // Draw string using current font 使用当前字体绘制字符串。
drawString(const String& string, int32_t x, int32_t y, uint8_t font),// Draw string using specified font number 使用指定的字体号绘制字符串。
drawString(const String& string, int32_t x, int32_t y),              // Draw string using current font 使用当前字体绘制字符串
//已弃用,请使用setTextDatum()和DrawString()。
drawCentreString(const char *string, int32_t x, int32_t y, uint8_t font),  // Deprecated, use setTextDatum() and drawString()
drawRightString(const char *string, int32_t x, int32_t y, uint8_t font),   // Deprecated, use setTextDatum() and drawString()
drawCentreString(const String& string, int32_t x, int32_t y, uint8_t font),// Deprecated, use setTextDatum() and drawString()
drawRightString(const String& string, int32_t x, int32_t y, uint8_t font); // Deprecated, use setTextDatum() and drawString()
// 设置光标
setCursor(int16_t x, int16_t y),                 // Set cursor for tft.print() 为tft.print()设置光标。
setCursor(int16_t x, int16_t y, uint8_t font);   // Set cursor and font number for tft.print() 设置tft.print()的光标和字体号。
// 获取光标位置
getCursorX(void),                                // Read current cursor x position (moves with tft.print()) 读取当前光标x位置(与tft.print()一起移动)。
getCursorY(void);                                // Read current cursor y position 读取当前光标y位置。
// 设置文本颜色
setTextColor(uint16_t color),                    // Set character (glyph) color only (background not over-written) 仅设置字符(字形)颜色(不覆盖背景)
setTextColor(uint16_t fgcolor, uint16_t bgcolor, bool bgfill = false),  // Set character (glyph) foreground and background colour, optional background fill for **ooth fonts
// 设置文本大小
setTextSize(uint8_t size);                       // Set character size multiplier (this increases pixel size)
// 设置文本换行
setTextWrap(bool wrapX, bool wrapY = false);     // Turn on/off wrapping of text in TFT width and/or height
// 设置文本日期
setTextDatum(uint8_t datum);                     // Set text datum position (default is top left), see Section 6 above
// 获取文本日期
getTextDatum(void);
// 设置文本填充
setTextPadding(uint16_t x_width);                // Set text padding (background blanking/over-write) width in pixels
// 获取文本填充
getTextPadding(void);                            // Get text padding
//将8位红、绿、蓝转换为16位
color565(uint8_t red, uint8_t green, uint8_t blue);
// Convert 8 bit colour to 16 bits
// 将8位颜色转换为16位
color8to16(uint8_t color332);
// Convert 16 bit colour to 8 bits
// 将16位颜色转换为8位
color16to8(uint16_t color565);
// Convert 16 bit colour to/from 24 bit, R+G+B concatenated into LS 24 bits
// 将16位颜色转换为24位,将R+G+B串联成LS 24位
color16to24(uint16_t color565);
color24to16(uint32_t color888);
// Alpha blend 2 colours, see generic "alphaBlend_Test" example
// alpha =   0 = 100% background colour
// alpha = 255 = 100% foreground colour
// Alpha混合2色,参见通用“AlphaBlend_Test”示例。
// Alpha=0=100%背景色。
// Alpha=255=100%前景色
alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc);
// 16 bit colour alphaBlend with alpha dither (dither reduces colour banding)
// 16位彩色字母与阿尔法抖动混合(抖动减少色带)
alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc, uint8_t dither);
// 24 bit colour alphaBlend with optional alpha dither
// 24位彩色字母混合,可选的阿尔法抖动
alphaBlend24(uint8_t alpha, uint32_t fgc, uint32_t bgc, uint8_t dither = 0);
    目录导航