首页 > 技术支持 > 应用与案例 > 正文
第四讲 单片机驱动彩色液晶屏 控制RA8889软件:绘图 作者:BW.SU   发表日期:2023-12-31   来源:菱致电子   浏览:
目录
第四讲 单片机驱动彩色液晶屏 控制RA8889软件:绘图
 

如何通过RA8889 / RA8876内建的图形驱动引擎来绘图?
RA8889内建丰富的图形绘制函数,包括:画线、画框、矩形、三角形、椭圆形、填色等等,各种常用的几何图形均包含了。

相比采用专用的GUI来说绘图速度会更快,比如绘制一个矩形,调用以下API即可,相当简单!

void Draw_Square_Fill(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2);


实例:
Draw_Square_Fill(0xFF0000,0,0,799,479);
作用:绘制一个800x480的填充矩形,硬件加速,相比GUI软件填充会快很多!

常用绘图功能:
(1)打点

void putPixel(unsigned short x,unsigned short y,unsigned long color);
 


(2)直线

void Draw_Line(unsigned long LineColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2);


(3)三角形

void Draw_Triangle(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X3,unsigned short Y3);
void Draw_Triangle_Fill(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X3,unsigned short Y3);

函数名后面加上“_Fill”表示填充,下同。

(4)矩形

void Draw_Square(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2);
void Draw_Square_Fill(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2);


(5)圆弧倒角矩形

void Draw_Circle_Square(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short R,unsigned short Y_R);
void Draw_Circle_Square_Fill(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short R,unsigned short Y_R);


(6)圆形

void Draw_Circle(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short R);
void Draw_Circle_Fill(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short R);


(7)椭圆形

void Draw_Ellipse(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Ellipse_Fill(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);


(8)圆弧形

void Draw_Left_Up_Curve(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Left_Down_Curve(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Right_Up_Curve(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Right_Down_Curve(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);

上方几个函数名后面加“_Fill”表示填充功能。

这些绘图API十分简洁,即使采用SPI串口方式与RA8889/RA8876进行通信,速度也是极快!也因此采用STM32F103C6T6 / STM32F103C8T6来作为主控MCU,也是也十分轻松!当然更低端的51单片机一样可以作为控制!

 第四讲 THE END


分享到:

相关热词搜索:RA8889 TFT控制芯片 绘图API

上一篇:第三讲 单片机驱动彩色液晶屏 控制RA8889软件:如何初始化
下一篇:第五讲 单片机驱动彩色液晶屏 显示文字:Part1.内部字库

>>延伸阅读:0

  • · 如何解决MCU与RA8889等液晶控制芯片的SPI通信问题 [2020-03-04]
  • · RA8889配套上位机使用简介 [2020-09-01]
  • · 介绍一颗51单片机就可以进行视频解码的芯片方案1366x768 [2020-09-07]
  • · RA88xx系列对显存直接读写点的方法 [2020-09-10]
  • · NAND FLASH的调用 [2020-09-14]