📄 paint.c
字号:
#include "paint.h"
/*==================================================================
* Function : paintPic
* Description : 绘图程序主函数
* Input Para : void ,由全局变量LedDotColor定义颜色,退出时LedDotColor=white;
* Output Para : void
* Return Value : void
==================================================================*/
void paintPic(void)
{
//背景色置为白色
lcd_display_full_screen_color(0xffff);
//初始化可画图区域。
TP_drawenable_start_x = LCD_FULL_SCREEN_X_START;
TP_drawenable_start_y = LCD_FULL_SCREEN_Y_START;
TP_drawenable_end_x = LCD_FULL_SCREEN_X_END;
TP_drawenable_end_y = LCD_FULL_SCREEN_Y_END-20;
//绘制绘图界面
lcd_display_rectangle_color(0,LCD_FULL_SCREEN_Y_END-20,26,LCD_FULL_SCREEN_Y_END,BLACK);
lcd_display_rectangle_color(29,LCD_FULL_SCREEN_Y_END-20,55,LCD_FULL_SCREEN_Y_END,RED);
lcd_display_rectangle_color(58,LCD_FULL_SCREEN_Y_END-20,84,LCD_FULL_SCREEN_Y_END,GREEN);
lcd_display_rectangle_color(87,LCD_FULL_SCREEN_Y_END-20,113,LCD_FULL_SCREEN_Y_END,BLUE);
//当前颜色指示,默认为黑色
lcd_display_rectangle_color(116,LCD_FULL_SCREEN_Y_END-20,144,LCD_FULL_SCREEN_Y_END,BLACK);
lcd_show_text(120,LCD_FULL_SCREEN_Y_END-18,'C',LedDotColor,0xFFFF);
lcd_show_text(128,LCD_FULL_SCREEN_Y_END-18,'L',LedDotColor,0xFFFF);
lcd_show_text(136,LCD_FULL_SCREEN_Y_END-18,'E',LedDotColor,0xFFFF);
lcd_show_text(146,LCD_FULL_SCREEN_Y_END-18,'E',0xFFFF,0x0000);
lcd_show_text(160,LCD_FULL_SCREEN_Y_END-18,'I',0xFFFF,0x0000);
lcd_show_text(154,LCD_FULL_SCREEN_Y_END-18,'X',0xFFFF,0x0000);
lcd_show_text(166,LCD_FULL_SCREEN_Y_END-18,'T',0xFFFF,0x0000);
//待添加
while(1)
{
//对位置作判断,确定是否为按钮
if(TP_start_y>LCD_FULL_SCREEN_Y_END-20)//在按钮区
{
if((TP_start_x<29)&&(TP_start_x>0)&&(LedDotColor!=BLACK))
{
//黑色选择;
LedDotColor = BLACK;
lcd_display_rectangle_color(116,LCD_FULL_SCREEN_Y_END-20,144,LCD_FULL_SCREEN_Y_END,BLACK);
lcd_show_text(120,LCD_FULL_SCREEN_Y_END-18,'C',LedDotColor,0xFFFF);
lcd_show_text(128,LCD_FULL_SCREEN_Y_END-18,'L',LedDotColor,0xFFFF);
lcd_show_text(136,LCD_FULL_SCREEN_Y_END-18,'E',LedDotColor,0xFFFF);
}
else if((TP_start_x < 58)&&(TP_start_x>29)&&(LedDotColor!=RED))
{
LedDotColor = RED;
lcd_display_rectangle_color(116,LCD_FULL_SCREEN_Y_END-20,144,LCD_FULL_SCREEN_Y_END,RED);
lcd_show_text(120,LCD_FULL_SCREEN_Y_END-18,'C',LedDotColor,0xFFFF);
lcd_show_text(128,LCD_FULL_SCREEN_Y_END-18,'L',LedDotColor,0xFFFF);
lcd_show_text(136,LCD_FULL_SCREEN_Y_END-18,'E',LedDotColor,0xFFFF);
}
else if((TP_start_x < 87)&&(TP_start_x>58)&&(LedDotColor!=GREEN))
{
LedDotColor = GREEN;
lcd_display_rectangle_color(116,LCD_FULL_SCREEN_Y_END-20,144,LCD_FULL_SCREEN_Y_END,GREEN);
lcd_show_text(120,LCD_FULL_SCREEN_Y_END-18,'C',LedDotColor,0xFFFF);
lcd_show_text(128,LCD_FULL_SCREEN_Y_END-18,'L',LedDotColor,0xFFFF);
lcd_show_text(136,LCD_FULL_SCREEN_Y_END-18,'E',LedDotColor,0xFFFF);
}
else if((TP_start_x < 116)&&(TP_start_x>87)&&(LedDotColor!=BLUE))
{
lcd_display_rectangle_color(116,LCD_FULL_SCREEN_Y_END-20,144,LCD_FULL_SCREEN_Y_END,BLUE);
LedDotColor = BLUE;
lcd_show_text(120,LCD_FULL_SCREEN_Y_END-18,'C',LedDotColor,0xFFFF);
lcd_show_text(128,LCD_FULL_SCREEN_Y_END-18,'L',LedDotColor,0xFFFF);
lcd_show_text(136,LCD_FULL_SCREEN_Y_END-18,'E',LedDotColor,0xFFFF);
}
else if((TP_start_x < 144)&&(TP_start_x>116))
{
//清除画图区域
lcd_display_rectangle_color(LCD_FULL_SCREEN_X_START,LCD_FULL_SCREEN_Y_START,LCD_FULL_SCREEN_X_END,LCD_FULL_SCREEN_Y_END-21,WHITE);
}
else if(TP_start_x > 144)
{
//lcd_display_rectangle_color(145,LCD_FULL_SCREEN_Y_END-20,176,LCD_FULL_SCREEN_Y_END,);
return ;//退出按钮,待补充
}
// lcd_display_rectangle_color(116,LCD_FULL_SCREEN_Y_END-20,144,LCD_FULL_SCREEN_Y_END,LedDotColor);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -