857 lines
24 KiB
C
857 lines
24 KiB
C
|
/**
|
|||
|
******************************************************************************
|
|||
|
* @file palette.c
|
|||
|
* @author fire
|
|||
|
* @version V1.0
|
|||
|
* @date 2016-xx-xx
|
|||
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
******************************************************************************
|
|||
|
* @attention
|
|||
|
*
|
|||
|
* ʵ<EFBFBD><EFBFBD>ƽ̨:Ұ<EFBFBD><EFBFBD> STM32 H750 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* <EFBFBD><EFBFBD>̳ :http://www.firebbs.cn
|
|||
|
* <EFBFBD>Ա<EFBFBD> :http://firestm32.taobao.com
|
|||
|
*
|
|||
|
******************************************************************************
|
|||
|
*/
|
|||
|
|
|||
|
#include "./touch/palette.h"
|
|||
|
#include "./touch/bsp_touch_gtxx.h"
|
|||
|
#include "./lcd/bsp_lcd.h"
|
|||
|
|
|||
|
extern uint32_t ActiveLayer;
|
|||
|
extern LCD_DrawPropTypeDef DrawProp[MAX_LAYER_NUMBER];
|
|||
|
|
|||
|
/*<2A><>ť<EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
Touch_Button button[BUTTON_NUM];
|
|||
|
|
|||
|
/*<2A><><EFBFBD>ʲ<EFBFBD><CAB2><EFBFBD>*/
|
|||
|
Brush_Style brush;
|
|||
|
|
|||
|
static void Draw_Color_Button(void *btn);
|
|||
|
static void Draw_Clear_Button(void *btn);
|
|||
|
static void Draw_Shape_Button(void *btn);
|
|||
|
|
|||
|
static void Command_Select_Color(void *btn);
|
|||
|
static void Command_Select_Brush(void *btn);
|
|||
|
static void Command_Clear_Palette(void *btn);
|
|||
|
|
|||
|
static void LCD_DrawUniLineCircle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,uint8_t thick );
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Palette_Init <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|||
|
* @param <EFBFBD><EFBFBD>
|
|||
|
* @retval <EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
void Palette_Init(void)
|
|||
|
{
|
|||
|
|
|||
|
uint8_t i;
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ɫ */
|
|||
|
LCD_Clear(LCD_COLOR_WHITE); /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾȫ<CABE><C8AB> */
|
|||
|
|
|||
|
|
|||
|
/* <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ť */
|
|||
|
Touch_Button_Init();
|
|||
|
|
|||
|
/* <20><><EFBFBD>水ť */
|
|||
|
for(i=0;i<BUTTON_NUM;i++)
|
|||
|
{
|
|||
|
button[i].draw_btn(&button[i]);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/* <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
brush.color = LCD_COLOR_BLACK;
|
|||
|
brush.shape = LINE_SINGLE_PIXCEL;
|
|||
|
|
|||
|
LCD_SetTextColor(brush.color);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Touch_Button_Init <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param <EFBFBD><EFBFBD>
|
|||
|
* @retval <EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
void Touch_Button_Init(void)
|
|||
|
{
|
|||
|
/*<2A><>һ<EFBFBD>У<EFBFBD><D0A3><EFBFBD>ҪΪ<D2AA><CEAA>ɫ<EFBFBD><C9AB>ť*/
|
|||
|
button[0].start_x = BUTTON_START_X;
|
|||
|
button[0].start_y = 0;
|
|||
|
button[0].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH ;
|
|||
|
button[0].end_y = COLOR_BLOCK_HEIGHT;
|
|||
|
button[0].para = LCD_COLOR_BLACK;
|
|||
|
button[0].touch_flag = 0;
|
|||
|
button[0].draw_btn = Draw_Color_Button ;
|
|||
|
button[0].btn_command = Command_Select_Color ;
|
|||
|
|
|||
|
button[1].start_x = BUTTON_START_X;
|
|||
|
button[1].start_y = COLOR_BLOCK_HEIGHT;
|
|||
|
button[1].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH ;
|
|||
|
button[1].end_y = COLOR_BLOCK_HEIGHT*2;
|
|||
|
button[1].para = LCD_COLOR_DARKGRAY;
|
|||
|
button[1].touch_flag = 0;
|
|||
|
button[1].draw_btn = Draw_Color_Button ;
|
|||
|
button[1].btn_command = Command_Select_Color ;
|
|||
|
|
|||
|
button[2].start_x = BUTTON_START_X;
|
|||
|
button[2].start_y = COLOR_BLOCK_HEIGHT*2;
|
|||
|
button[2].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH ;
|
|||
|
button[2].end_y = COLOR_BLOCK_HEIGHT*3;
|
|||
|
button[2].para = LCD_COLOR_BLUE;
|
|||
|
button[2].touch_flag = 0;
|
|||
|
button[2].draw_btn = Draw_Color_Button ;
|
|||
|
button[2].btn_command = Command_Select_Color ;
|
|||
|
|
|||
|
button[3].start_x = BUTTON_START_X;
|
|||
|
button[3].start_y = COLOR_BLOCK_HEIGHT*3;
|
|||
|
button[3].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH ;
|
|||
|
button[3].end_y = COLOR_BLOCK_HEIGHT*4;
|
|||
|
button[3].para = LCD_COLOR_DARKBLUE;
|
|||
|
button[3].touch_flag = 0;
|
|||
|
button[3].draw_btn = Draw_Color_Button ;
|
|||
|
button[3].btn_command = Command_Select_Color ;
|
|||
|
|
|||
|
button[4].start_x = BUTTON_START_X;
|
|||
|
button[4].start_y = COLOR_BLOCK_HEIGHT*4;
|
|||
|
button[4].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH ;
|
|||
|
button[4].end_y = COLOR_BLOCK_HEIGHT*5;
|
|||
|
button[4].para = LCD_COLOR_RED;
|
|||
|
button[4].touch_flag = 0;
|
|||
|
button[4].draw_btn = Draw_Color_Button ;
|
|||
|
button[4].btn_command = Command_Select_Color ;
|
|||
|
|
|||
|
button[5].start_x = BUTTON_START_X;
|
|||
|
button[5].start_y = COLOR_BLOCK_HEIGHT*5;
|
|||
|
button[5].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH ;
|
|||
|
button[5].end_y = COLOR_BLOCK_HEIGHT*6;
|
|||
|
button[5].para = LCD_COLOR_MAGENTA;
|
|||
|
button[5].touch_flag = 0;
|
|||
|
button[5].draw_btn = Draw_Color_Button ;
|
|||
|
button[5].btn_command = Command_Select_Color ;
|
|||
|
|
|||
|
button[6].start_x = BUTTON_START_X;
|
|||
|
button[6].start_y = COLOR_BLOCK_HEIGHT*6;
|
|||
|
button[6].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH ;
|
|||
|
button[6].end_y = COLOR_BLOCK_HEIGHT*7;
|
|||
|
button[6].para = LCD_COLOR_GREEN;
|
|||
|
button[6].touch_flag = 0;
|
|||
|
button[6].draw_btn = Draw_Color_Button ;
|
|||
|
button[6].btn_command = Command_Select_Color ;
|
|||
|
|
|||
|
button[7].start_x = BUTTON_START_X;
|
|||
|
button[7].start_y = COLOR_BLOCK_HEIGHT*7;
|
|||
|
button[7].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH ;
|
|||
|
button[7].end_y = COLOR_BLOCK_HEIGHT*8;
|
|||
|
button[7].para = LCD_COLOR_CYAN;
|
|||
|
button[7].touch_flag = 0;
|
|||
|
button[7].draw_btn = Draw_Color_Button ;
|
|||
|
button[7].btn_command = Command_Select_Color ;
|
|||
|
|
|||
|
button[8].start_x = BUTTON_START_X;
|
|||
|
button[8].start_y = COLOR_BLOCK_HEIGHT*8;
|
|||
|
button[8].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH ;
|
|||
|
button[8].end_y = LCD_PIXEL_HEIGHT;
|
|||
|
button[8].para = LCD_COLOR_LIGHTGRAY;
|
|||
|
button[8].touch_flag = 0;
|
|||
|
button[8].draw_btn = Draw_Clear_Button ;
|
|||
|
button[8].btn_command = Command_Clear_Palette ;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/*<2A>ڶ<EFBFBD><DAB6>У<EFBFBD><D0A3><EFBFBD>ҪΪ<D2AA><CEAA>ˢ<EFBFBD><CBA2>ť*/
|
|||
|
button[9].start_x = BUTTON_START_X + COLOR_BLOCK_WIDTH;
|
|||
|
button[9].start_y = 0;
|
|||
|
button[9].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH*2 ;
|
|||
|
button[9].end_y = COLOR_BLOCK_HEIGHT;
|
|||
|
button[9].para = LINE_SINGLE_PIXCEL;
|
|||
|
button[9].touch_flag = 0;
|
|||
|
button[9].draw_btn = Draw_Shape_Button ;
|
|||
|
button[9].btn_command = Command_Select_Brush ;
|
|||
|
|
|||
|
button[10].start_x = BUTTON_START_X + COLOR_BLOCK_WIDTH;
|
|||
|
button[10].start_y = COLOR_BLOCK_HEIGHT;
|
|||
|
button[10].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH*2 ;
|
|||
|
button[10].end_y = COLOR_BLOCK_HEIGHT*2;
|
|||
|
button[10].para = LINE_2_PIXCEL;
|
|||
|
button[10].touch_flag = 0;
|
|||
|
button[10].draw_btn = Draw_Shape_Button ;
|
|||
|
button[10].btn_command = Command_Select_Brush ;
|
|||
|
|
|||
|
button[11].start_x = BUTTON_START_X + COLOR_BLOCK_WIDTH;
|
|||
|
button[11].start_y = COLOR_BLOCK_HEIGHT*2;
|
|||
|
button[11].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH*2 ;
|
|||
|
button[11].end_y = COLOR_BLOCK_HEIGHT*3;
|
|||
|
button[11].para = LINE_4_PIXCEL;
|
|||
|
button[11].touch_flag = 0;
|
|||
|
button[11].draw_btn = Draw_Shape_Button ;
|
|||
|
button[11].btn_command = Command_Select_Brush ;
|
|||
|
|
|||
|
button[12].start_x = BUTTON_START_X + COLOR_BLOCK_WIDTH;
|
|||
|
button[12].start_y = COLOR_BLOCK_HEIGHT*3;
|
|||
|
button[12].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH*2 ;
|
|||
|
button[12].end_y = COLOR_BLOCK_HEIGHT*4;
|
|||
|
button[12].para = LINE_6_PIXCEL;
|
|||
|
button[12].touch_flag = 0;
|
|||
|
button[12].draw_btn = Draw_Shape_Button ;
|
|||
|
button[12].btn_command = Command_Select_Brush ;
|
|||
|
|
|||
|
button[13].start_x = BUTTON_START_X + COLOR_BLOCK_WIDTH;
|
|||
|
button[13].start_y = COLOR_BLOCK_HEIGHT*4;
|
|||
|
button[13].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH*2 ;
|
|||
|
button[13].end_y = COLOR_BLOCK_HEIGHT*5;
|
|||
|
button[13].para = LINE_8_PIXCEL;
|
|||
|
button[13].touch_flag = 0;
|
|||
|
button[13].draw_btn = Draw_Shape_Button ;
|
|||
|
button[13].btn_command = Command_Select_Brush ;
|
|||
|
|
|||
|
button[14].start_x = BUTTON_START_X + COLOR_BLOCK_WIDTH;
|
|||
|
button[14].start_y = COLOR_BLOCK_HEIGHT*5;
|
|||
|
button[14].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH*2 ;
|
|||
|
button[14].end_y = COLOR_BLOCK_HEIGHT*6;
|
|||
|
button[14].para = LINE_16_PIXCEL;
|
|||
|
button[14].touch_flag = 0;
|
|||
|
button[14].draw_btn = Draw_Shape_Button ;
|
|||
|
button[14].btn_command = Command_Select_Brush ;
|
|||
|
|
|||
|
button[15].start_x = BUTTON_START_X + COLOR_BLOCK_WIDTH;
|
|||
|
button[15].start_y = COLOR_BLOCK_HEIGHT*6;
|
|||
|
button[15].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH*2 ;
|
|||
|
button[15].end_y = COLOR_BLOCK_HEIGHT*7;
|
|||
|
button[15].para = LINE_20_PIXCEL;
|
|||
|
button[15].touch_flag = 0;
|
|||
|
button[15].draw_btn = Draw_Shape_Button ;
|
|||
|
button[15].btn_command = Command_Select_Brush ;
|
|||
|
|
|||
|
button[16].start_x = BUTTON_START_X + COLOR_BLOCK_WIDTH;
|
|||
|
button[16].start_y = COLOR_BLOCK_HEIGHT*7;
|
|||
|
button[16].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH*2 ;
|
|||
|
button[16].end_y = COLOR_BLOCK_HEIGHT*8;
|
|||
|
button[16].para = LINE_WITH_CIRCLE;
|
|||
|
button[16].touch_flag = 0;
|
|||
|
button[16].draw_btn = Draw_Shape_Button ;
|
|||
|
button[16].btn_command = Command_Select_Brush ;
|
|||
|
|
|||
|
button[17].start_x = BUTTON_START_X + COLOR_BLOCK_WIDTH;
|
|||
|
button[17].start_y = COLOR_BLOCK_HEIGHT*8;
|
|||
|
button[17].end_x = BUTTON_START_X+COLOR_BLOCK_WIDTH*2 ;
|
|||
|
button[17].end_y = LCD_PIXEL_HEIGHT;
|
|||
|
button[17].para = RUBBER;
|
|||
|
button[17].touch_flag = 0;
|
|||
|
button[17].draw_btn = Draw_Shape_Button ;
|
|||
|
button[17].btn_command = Command_Select_Brush ;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Touch_Button_Down <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>õĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param x <EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD>x<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param y <EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD>y<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @retval <EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
void Touch_Button_Down(uint16_t x,uint16_t y)
|
|||
|
{
|
|||
|
uint8_t i;
|
|||
|
for(i=0;i<BUTTON_NUM;i++)
|
|||
|
{
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˰<EFBFBD>ť */
|
|||
|
if(x<=button[i].end_x && y<=button[i].end_y && y>=button[i].start_y && x>=button[i].start_x )
|
|||
|
{
|
|||
|
if(button[i].touch_flag == 0) /*ԭ<><D4AD><EFBFBD><EFBFBD>״̬Ϊû<CEAA>а<EFBFBD><D0B0>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬*/
|
|||
|
{
|
|||
|
button[i].touch_flag = 1; /* <20><>¼<EFBFBD><C2BC><EFBFBD>±<EFBFBD>־ */
|
|||
|
|
|||
|
button[i].draw_btn(&button[i]); /*<2A>ػ水ť*/
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
else if(button[i].touch_flag == 1) /* <20><><EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD><C6B3>˰<EFBFBD><CBB0><EFBFBD><EFBFBD>ķ<EFBFBD>Χ<EFBFBD><CEA7>֮ǰ<D6AE>а<EFBFBD><D0B0>°<EFBFBD>ť */
|
|||
|
{
|
|||
|
button[i].touch_flag = 0; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD>־<EFBFBD><D6BE><EFBFBD>ж<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
|
|||
|
button[i].draw_btn(&button[i]); /*<2A>ػ水ť*/
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Touch_Button_Up <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>õĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param x <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ʱ<EFBFBD><EFBFBD>x<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param y <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ʱ<EFBFBD><EFBFBD>y<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @retval <EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
void Touch_Button_Up(uint16_t x,uint16_t y)
|
|||
|
{
|
|||
|
uint8_t i;
|
|||
|
for(i=0;i<BUTTON_NUM;i++)
|
|||
|
{
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>ڰ<EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD> */
|
|||
|
if((x<button[i].end_x && x>button[i].start_x && y<button[i].end_y && y>button[i].start_y))
|
|||
|
{
|
|||
|
button[i].touch_flag = 0; /*<2A>ͷŴ<CDB7><C5B4><EFBFBD><EFBFBD><EFBFBD>־*/
|
|||
|
|
|||
|
button[i].draw_btn(&button[i]); /*<2A>ػ水ť*/
|
|||
|
|
|||
|
button[i].btn_command(&button[i]); /*ִ<>а<EFBFBD><D0B0><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Draw_Trail <EFBFBD>ڻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>津<EFBFBD><EFBFBD><EFBFBD>켣
|
|||
|
* @param pre_x <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>x<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param pre_y <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>y<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param x <EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>x<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param y <EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>y<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param brush <EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @retval <EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
void Draw_Trail(int16_t pre_x,int16_t pre_y,int16_t x,int16_t y,Brush_Style* brush)
|
|||
|
{
|
|||
|
/*<2A><><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EEB6AF><EFBFBD><EFBFBD>,bsp_lcd.c<><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ滭<C6BB><E6BBAD><EFBFBD><EFBFBD>*/
|
|||
|
// RA8875_SetActiveWindow(PALETTE_START_X,PALETTE_START_Y,PALETTE_END_X,PALETTE_END_Y);
|
|||
|
|
|||
|
|
|||
|
/*<2A><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
if(x>PALETTE_START_X && pre_x>PALETTE_START_X )
|
|||
|
{
|
|||
|
switch(brush->shape) /*<2A><><EFBFBD>ݻ<EFBFBD>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>治ͬ<E6B2BB>Ĺ켣*/
|
|||
|
{
|
|||
|
/* <20><><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD>ؿ<EFBFBD><D8BF>ȵĹ켣<C4B9><ECBCA3> */
|
|||
|
case LINE_SINGLE_PIXCEL:
|
|||
|
if(pre_x< 0 || pre_y < 0) //<2F>µıʼ<C4B1>
|
|||
|
{
|
|||
|
LCD_DrawPixel(x, y, DrawProp[ActiveLayer].TextColor);
|
|||
|
}
|
|||
|
else //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>εıʼ<C4B1>
|
|||
|
{
|
|||
|
LCD_DrawLine(pre_x,pre_y,x,y);
|
|||
|
}
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case LINE_2_PIXCEL:
|
|||
|
|
|||
|
if(x-1<PALETTE_START_X||pre_x-1<PALETTE_START_X) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD>
|
|||
|
break;
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD>ؿ<EFBFBD><D8BF>ȵĹ켣<C4B9><ECBCA3> */
|
|||
|
LCD_DrawUniLineCircle(pre_x,pre_y,x,y,1);
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case LINE_4_PIXCEL:
|
|||
|
|
|||
|
if(x-2<PALETTE_START_X||pre_x-2<PALETTE_START_X) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD>
|
|||
|
break;
|
|||
|
|
|||
|
LCD_DrawUniLineCircle(pre_x,pre_y,x,y,2);
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case LINE_6_PIXCEL:
|
|||
|
|
|||
|
if(x-3<PALETTE_START_X||pre_x-3<PALETTE_START_X) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD>
|
|||
|
break;
|
|||
|
|
|||
|
LCD_DrawUniLineCircle(pre_x,pre_y,x,y,3);
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case LINE_8_PIXCEL:
|
|||
|
|
|||
|
if(x-4<PALETTE_START_X||pre_x-4<PALETTE_START_X) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD>
|
|||
|
break;
|
|||
|
|
|||
|
LCD_DrawUniLineCircle(pre_x,pre_y,x,y,4);
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case LINE_16_PIXCEL:
|
|||
|
|
|||
|
if(x-8<PALETTE_START_X||pre_x-8<PALETTE_START_X) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD>
|
|||
|
break;
|
|||
|
|
|||
|
LCD_DrawUniLineCircle(pre_x,pre_y,x,y,8);
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case LINE_20_PIXCEL:
|
|||
|
|
|||
|
if(x-10<PALETTE_START_X ||pre_x-10<PALETTE_START_X) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD>
|
|||
|
break;
|
|||
|
|
|||
|
LCD_DrawUniLineCircle(pre_x,pre_y,x,y,10);
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵĵ<D3B5><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
case LINE_WITH_CIRCLE:
|
|||
|
|
|||
|
if(x-3<PALETTE_START_X||pre_x-3<PALETTE_START_X) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD>
|
|||
|
break;
|
|||
|
|
|||
|
if(pre_x< 0 || pre_y< 0)//<2F>µıʼ<C4B1>
|
|||
|
{
|
|||
|
LCD_DrawPixel(x, y, DrawProp[ActiveLayer].TextColor);
|
|||
|
}
|
|||
|
else //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>εıʼ<C4B1>
|
|||
|
{
|
|||
|
LCD_DrawLine(pre_x,pre_y,x,y);
|
|||
|
LCD_FillCircle(x,y,3);
|
|||
|
}
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
/*<2A><>Ƥ<EFBFBD><C6A4><EFBFBD><EFBFBD>*/
|
|||
|
case RUBBER:
|
|||
|
|
|||
|
if(x-20<PALETTE_START_X || //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD>
|
|||
|
x+20>LCD_PIXEL_WIDTH || x-20<0 || //Һ<><D2BA><EFBFBD><EFBFBD><EFBFBD>ұ߽<D2B1>
|
|||
|
y+20>LCD_PIXEL_HEIGHT || y-20<0) //Һ<><D2BA><EFBFBD><EFBFBD><EFBFBD>±߽<C2B1>
|
|||
|
break;
|
|||
|
|
|||
|
// if(x>PALETTE_START_X+20)
|
|||
|
{
|
|||
|
LCD_SetColors(LCD_COLOR_WHITE,LCD_COLOR_WHITE);
|
|||
|
|
|||
|
LCD_FillRect( x-40/2,
|
|||
|
y-40/2,
|
|||
|
40,
|
|||
|
40);
|
|||
|
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/*<2A>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><DEBB><EFBFBD><EFBFBD>Ļ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ڣ<EFBFBD>bsp_lcd.c<><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ滭<C6BB><E6BBAD><EFBFBD><EFBFBD>*/
|
|||
|
// RA8875_SetActiveWindow(0,0,LCD_PIXEL_WIDTH,LCD_PIXEL_HEIGHT);
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Draw_Color_Button <EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD>ť<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>溯<EFBFBD><EFBFBD>
|
|||
|
* @param btn Touch_Button <EFBFBD><EFBFBD><EFBFBD>͵İ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @retval <EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
static void Draw_Color_Button(void *btn)
|
|||
|
{
|
|||
|
Touch_Button *ptr = (Touch_Button *)btn;
|
|||
|
|
|||
|
/*<2A>ͷŰ<CDB7><C5B0><EFBFBD>*/
|
|||
|
if(ptr->touch_flag == 0)
|
|||
|
{
|
|||
|
/*<2A><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ܼ<EFBFBD><DCBC><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ɫ*/
|
|||
|
LCD_SetColors(ptr->para,LCD_COLOR_WHITE);
|
|||
|
LCD_FillRect(ptr->start_x,
|
|||
|
ptr->start_y,
|
|||
|
ptr->end_x - ptr->start_x,
|
|||
|
ptr->end_y - ptr->start_y);
|
|||
|
}
|
|||
|
else /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
{
|
|||
|
/*<2A><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>*/
|
|||
|
LCD_SetColors(LCD_COLOR_WHITE,LCD_COLOR_WHITE);
|
|||
|
LCD_FillRect(ptr->start_x,
|
|||
|
ptr->start_y,
|
|||
|
ptr->end_x - ptr->start_x,
|
|||
|
ptr->end_y - ptr->start_y);
|
|||
|
}
|
|||
|
/*<2A><>ť<EFBFBD>߿<EFBFBD>*/
|
|||
|
LCD_SetColors(LCD_COLOR_DARKBLUE,LCD_COLOR_WHITE);
|
|||
|
LCD_DrawRect(ptr->start_x,
|
|||
|
ptr->start_y,
|
|||
|
ptr->end_x - ptr->start_x,
|
|||
|
ptr->end_y - ptr->start_y);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Draw_Clear_Button <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>溯<EFBFBD><EFBFBD>
|
|||
|
* @param btn Touch_Button <EFBFBD><EFBFBD><EFBFBD>͵İ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @retval <EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
static void Draw_Clear_Button(void *btn)
|
|||
|
{
|
|||
|
Touch_Button *ptr = (Touch_Button *)btn;
|
|||
|
|
|||
|
/*<2A>ͷŰ<CDB7><C5B0><EFBFBD>*/
|
|||
|
if(ptr->touch_flag == 0)
|
|||
|
{
|
|||
|
|
|||
|
LCD_SetColors(LCD_COLOR_LIGHTGRAY,LCD_COLOR_WHITE);
|
|||
|
LCD_FillRect(ptr->start_x,
|
|||
|
ptr->start_y,
|
|||
|
ptr->end_x - ptr->start_x,
|
|||
|
ptr->end_y - ptr->start_y);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
LCD_SetColors(LCD_COLOR_RED,LCD_COLOR_LIGHTGRAY);
|
|||
|
/*ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD>壬ʹ<E5A3AC><CAB9><EFBFBD><EFBFBD>Ӣ<EFBFBD><D3A2><EFBFBD><EFBFBD>ʾʱ<CABE><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӣ<EFBFBD><D3A2>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>16*24<32><34><EFBFBD><EFBFBD><EFBFBD>壬
|
|||
|
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD>24*24<EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ*/
|
|||
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>Ӣ<EFBFBD><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
LCD_SetFont(&LCD_DEFAULT_FONT);
|
|||
|
LCD_DispString_EN_CH( (ptr->end_y - ptr->start_y)/2 + ptr->start_y - 12,
|
|||
|
(ptr->end_x - ptr->start_x)/2 - 6,
|
|||
|
(uint8_t*)"C");//<2F><><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
else /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
{
|
|||
|
|
|||
|
LCD_SetColors(LCD_COLOR_WHITE,LCD_COLOR_WHITE);
|
|||
|
LCD_FillRect(ptr->start_x,
|
|||
|
ptr->start_y,
|
|||
|
ptr->end_x - ptr->start_x,
|
|||
|
ptr->end_y - ptr->start_y);
|
|||
|
|
|||
|
|
|||
|
LCD_SetColors(LCD_COLOR_RED,LCD_COLOR_WHITE);
|
|||
|
/*ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD>壬ʹ<E5A3AC><CAB9><EFBFBD><EFBFBD>Ӣ<EFBFBD><D3A2><EFBFBD><EFBFBD>ʾʱ<CABE><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӣ<EFBFBD><D3A2>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>16*24<32><34><EFBFBD><EFBFBD><EFBFBD>壬
|
|||
|
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD>24*24<EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ*/
|
|||
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>Ӣ<EFBFBD><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
LCD_SetFont(&LCD_DEFAULT_FONT);
|
|||
|
// LCD_DispString_EN_CH( ptr->start_y+25,
|
|||
|
// ptr->start_x + (ptr->end_x - ptr->start_x - 24*2 )/2,
|
|||
|
// (uint8_t*)"<22><><EFBFBD><EFBFBD>");
|
|||
|
}
|
|||
|
|
|||
|
/*<2A><>ť<EFBFBD>߿<EFBFBD>*/
|
|||
|
LCD_SetColors(LCD_COLOR_DARKBLUE,LCD_COLOR_WHITE);
|
|||
|
LCD_DrawRect(ptr->start_x,
|
|||
|
ptr->start_y,
|
|||
|
ptr->end_x - ptr->start_x,
|
|||
|
ptr->end_y - ptr->start_y);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Draw_Shape_Button <EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD>ť<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>溯<EFBFBD><EFBFBD>
|
|||
|
* @param btn Touch_Button <EFBFBD><EFBFBD><EFBFBD>͵İ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @retval <EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
static void Draw_Shape_Button(void *btn)
|
|||
|
{
|
|||
|
Touch_Button *ptr = (Touch_Button *)btn;
|
|||
|
|
|||
|
uint16_t i;
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ û<><C3BB><EFBFBD><EFBFBD>ʱΪ<CAB1><CEAA>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱΪ<CAB1><CEAA>ɫ*/
|
|||
|
if(ptr->touch_flag ==0 )
|
|||
|
{
|
|||
|
|
|||
|
LCD_SetColors(LCD_COLOR_LIGHTGRAY,LCD_COLOR_WHITE);
|
|||
|
LCD_FillRect(ptr->start_x,
|
|||
|
ptr->start_y,
|
|||
|
ptr->end_x - ptr->start_x,
|
|||
|
ptr->end_y - ptr->start_y);
|
|||
|
|
|||
|
|
|||
|
/*<2A><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>ʱ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>ɫ*/
|
|||
|
LCD_SetColors(LCD_COLOR_DARKBLUE,LCD_COLOR_LIGHTGRAY);
|
|||
|
LCD_DrawRect(ptr->start_x,
|
|||
|
ptr->start_y,
|
|||
|
ptr->end_x - ptr->start_x,
|
|||
|
ptr->end_y - ptr->start_y);
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
LCD_SetColors(LCD_COLOR_WHITE,LCD_COLOR_WHITE);
|
|||
|
LCD_FillRect(ptr->start_x,
|
|||
|
ptr->start_y,
|
|||
|
ptr->end_x - ptr->start_x,
|
|||
|
ptr->end_y - ptr->start_y);
|
|||
|
|
|||
|
|
|||
|
/*<2A><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>ʱ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>ɫ*/
|
|||
|
LCD_SetColors(LCD_COLOR_DARKBLUE,LCD_COLOR_WHITE);
|
|||
|
LCD_DrawRect(ptr->start_x,
|
|||
|
ptr->start_y,
|
|||
|
ptr->end_x - ptr->start_x,
|
|||
|
ptr->end_y - ptr->start_y);
|
|||
|
}
|
|||
|
|
|||
|
LCD_SetColors(LCD_COLOR_BLACK,LCD_COLOR_WHITE);
|
|||
|
/*<2A><><EFBFBD>ݻ<EFBFBD>ˢ<EFBFBD><CBA2>״<EFBFBD><D7B4><EFBFBD>水ťͼ<C5A5><CDBC>*/
|
|||
|
switch(ptr->para)
|
|||
|
{
|
|||
|
|
|||
|
case LINE_SINGLE_PIXCEL:
|
|||
|
|
|||
|
LCD_SetColors(LCD_COLOR_BLACK,LCD_COLOR_WHITE);
|
|||
|
LCD_DrawLine(ptr->start_x+20,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2,
|
|||
|
ptr->end_x-20,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2);
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
|
|||
|
case LINE_2_PIXCEL:
|
|||
|
|
|||
|
LCD_DrawUniLineCircle(ptr->start_x+20,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2,ptr->end_x-20,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2,
|
|||
|
1);
|
|||
|
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case LINE_4_PIXCEL:
|
|||
|
|
|||
|
LCD_DrawUniLineCircle(ptr->start_x+20,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2,ptr->end_x-20,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2,
|
|||
|
2);
|
|||
|
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case LINE_6_PIXCEL:
|
|||
|
|
|||
|
LCD_DrawUniLineCircle(ptr->start_x+20,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2,ptr->end_x-20,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2,
|
|||
|
3);
|
|||
|
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case LINE_8_PIXCEL:
|
|||
|
|
|||
|
LCD_DrawUniLineCircle(ptr->start_x+20,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2,ptr->end_x-20,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2,
|
|||
|
4);
|
|||
|
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case LINE_16_PIXCEL:
|
|||
|
|
|||
|
LCD_DrawUniLineCircle(ptr->start_x+20,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2,ptr->end_x-20,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2,
|
|||
|
8 );
|
|||
|
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
case LINE_20_PIXCEL:
|
|||
|
|
|||
|
LCD_DrawUniLineCircle(ptr->start_x+20,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2,ptr->end_x-20,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2,
|
|||
|
10);
|
|||
|
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
case LINE_WITH_CIRCLE:
|
|||
|
LCD_SetColors(LCD_COLOR_BLACK,LCD_COLOR_WHITE);
|
|||
|
LCD_DrawLine(ptr->start_x+5,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2,
|
|||
|
ptr->end_x-5,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2);
|
|||
|
|
|||
|
|
|||
|
for(i=0;i<((ptr->end_x - ptr->start_x-10)/10);i++)
|
|||
|
{
|
|||
|
|
|||
|
LCD_FillCircle(ptr->start_x+5+i*10,
|
|||
|
ptr->start_y+(ptr->end_y-ptr->start_y)/2,
|
|||
|
3);
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
|
|||
|
case RUBBER:
|
|||
|
// LCD_SetColors(LCD_COLOR_WHITE,LCD_COLOR_BLACK);
|
|||
|
// LCD_FillRect( ptr->start_x+((ptr->end_x - ptr->start_x -40)/2),
|
|||
|
// ptr->start_y+ ((ptr->end_y - ptr->start_y-40 -30)/2),
|
|||
|
// 40,
|
|||
|
// 40 ); // <20><><EFBFBD><EFBFBD><EFBFBD>ο<EFBFBD>
|
|||
|
|
|||
|
|
|||
|
LCD_SetColors(LCD_COLOR_RED,LCD_COLOR_LIGHTGRAY);
|
|||
|
|
|||
|
/*ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD>壬ʹ<E5A3AC><CAB9><EFBFBD><EFBFBD>Ӣ<EFBFBD><D3A2><EFBFBD><EFBFBD>ʾʱ<CABE><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӣ<EFBFBD><D3A2>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>16*24<32><34><EFBFBD><EFBFBD><EFBFBD>壬
|
|||
|
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD>24*24<EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ*/
|
|||
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>Ӣ<EFBFBD><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
LCD_SetFont(&Font24);
|
|||
|
LCD_DispString_EN_CH((ptr->end_y - ptr->start_y)/2 + ptr->start_y - 12,
|
|||
|
ptr->start_x + (ptr->end_x - ptr->start_x)/2 - 6,
|
|||
|
(uint8_t*)"R");//<2F><>Ƥ
|
|||
|
|
|||
|
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Command_Select_Color <EFBFBD>л<EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>к<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param btn Touch_Button <EFBFBD><EFBFBD><EFBFBD>͵İ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @retval <EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
static void Command_Select_Color(void *btn)
|
|||
|
{
|
|||
|
Touch_Button *ptr = (Touch_Button *)btn;
|
|||
|
|
|||
|
brush.color = ptr->para;
|
|||
|
LCD_SetColors(brush.color,LCD_COLOR_WHITE);
|
|||
|
|
|||
|
if(brush.shape == RUBBER)
|
|||
|
{
|
|||
|
brush.shape = LINE_SINGLE_PIXCEL;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Command_Select_Brush <EFBFBD>л<EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>к<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param btn Touch_Button <EFBFBD><EFBFBD><EFBFBD>͵İ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @retval <EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
static void Command_Select_Brush(void *btn)
|
|||
|
{
|
|||
|
Touch_Button *ptr = (Touch_Button *)btn;
|
|||
|
brush.shape =(SHAPE) ptr->para;
|
|||
|
LCD_SetColors(brush.color,LCD_COLOR_WHITE);
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Command_Select_Brush <EFBFBD>л<EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>к<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param btn Touch_Button <EFBFBD><EFBFBD><EFBFBD>͵İ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @retval <EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
static void Command_Clear_Palette(void *btn)
|
|||
|
{
|
|||
|
LCD_SetColors(LCD_COLOR_WHITE,LCD_COLOR_WHITE);
|
|||
|
LCD_FillRect(PALETTE_START_X,
|
|||
|
PALETTE_START_Y,
|
|||
|
PALETTE_END_X-(PALETTE_START_X+1),
|
|||
|
PALETTE_END_Y-PALETTE_START_Y );
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#define ABS(X) ((X) > 0 ? (X) : -(X))
|
|||
|
|
|||
|
/**
|
|||
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>켣
|
|||
|
* @param x1: specifies the point 1 x position.
|
|||
|
* @param y1: specifies the point 1 y position.
|
|||
|
* @param x2: specifies the point 2 x position.
|
|||
|
* @param y2: specifies the point 2 y position.
|
|||
|
* @retval None
|
|||
|
*/
|
|||
|
static void LCD_DrawUniLineCircle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,uint8_t thick )
|
|||
|
{
|
|||
|
int16_t deltax = 0, deltay = 0, x = 0, y = 0, xinc1 = 0, xinc2 = 0,
|
|||
|
yinc1 = 0, yinc2 = 0, den = 0, num = 0, numadd = 0, numpixels = 0,
|
|||
|
curpixel = 0;
|
|||
|
|
|||
|
deltax = ABS(x2 - x1); /* The difference between the x's */
|
|||
|
deltay = ABS(y2 - y1); /* The difference between the y's */
|
|||
|
x = x1; /* Start x off at the first pixel */
|
|||
|
y = y1; /* Start y off at the first pixel */
|
|||
|
|
|||
|
|
|||
|
if (x2 >= x1) /* The x-values are increasing */
|
|||
|
{
|
|||
|
xinc1 = 1;
|
|||
|
xinc2 = 1;
|
|||
|
}
|
|||
|
else /* The x-values are decreasing */
|
|||
|
{
|
|||
|
xinc1 = -1;
|
|||
|
xinc2 = -1;
|
|||
|
}
|
|||
|
|
|||
|
if (y2 >= y1) /* The y-values are increasing */
|
|||
|
{
|
|||
|
yinc1 = 1;
|
|||
|
yinc2 = 1;
|
|||
|
}
|
|||
|
else /* The y-values are decreasing */
|
|||
|
{
|
|||
|
yinc1 = -1;
|
|||
|
yinc2 = -1;
|
|||
|
}
|
|||
|
|
|||
|
if (deltax >= deltay) /* There is at least one x-value for every y-value */
|
|||
|
{
|
|||
|
xinc1 = 0; /* Don't change the x when numerator >= denominator */
|
|||
|
yinc2 = 0; /* Don't change the y for every iteration */
|
|||
|
den = deltax;
|
|||
|
num = deltax / 2;
|
|||
|
numadd = deltay;
|
|||
|
numpixels = deltax; /* There are more x-values than y-values */
|
|||
|
}
|
|||
|
else /* There is at least one y-value for every x-value */
|
|||
|
{
|
|||
|
xinc2 = 0; /* Don't change the x for every iteration */
|
|||
|
yinc1 = 0; /* Don't change the y when numerator >= denominator */
|
|||
|
den = deltay;
|
|||
|
num = deltay / 2;
|
|||
|
numadd = deltax;
|
|||
|
numpixels = deltay; /* There are more y-values than x-values */
|
|||
|
}
|
|||
|
|
|||
|
for (curpixel = 0; curpixel <= numpixels; curpixel++)
|
|||
|
{
|
|||
|
|
|||
|
//<2F>жϱ߽<CFB1>
|
|||
|
if(x+thick>LCD_PIXEL_WIDTH || x-thick<0 || //Һ<><D2BA><EFBFBD><EFBFBD><EFBFBD>ұ߽<D2B1>
|
|||
|
y+thick>LCD_PIXEL_HEIGHT || y-thick<0 ) //Һ<><D2BA><EFBFBD><EFBFBD><EFBFBD>±߽<C2B1>
|
|||
|
continue;
|
|||
|
|
|||
|
LCD_FillCircle(x,y,thick); /* Draw the current pixel */
|
|||
|
num += numadd; /* Increase the numerator by the top of the fraction */
|
|||
|
if (num >= den) /* Check if numerator >= denominator */
|
|||
|
{
|
|||
|
num -= den; /* Calculate the new numerator value */
|
|||
|
x += xinc1; /* Change the x as appropriate */
|
|||
|
y += yinc1; /* Change the y as appropriate */
|
|||
|
}
|
|||
|
x += xinc2; /* Change the x as appropriate */
|
|||
|
y += yinc2; /* Change the y as appropriate */
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/* ------------------------------------------end of file---------------------------------------- */
|
|||
|
|
|||
|
|
|||
|
|