2019-07-21 00:29发布
guobo123 发表于 2015-12-29 15:36 我已经加过#include "GUI_Private.h"这个头文件
guobo123 发表于 2015-12-29 15:50 #include "LCD_Private.h" /* private modul definitions & config */ #include "GUI_Private.h" #i ...
最多设置5个标签!
如果你是带UCGUI的话,在前面加一个#include "GUI_Private.h",里面有定义LCD_COLORINDEX的
你把文件发出来看吧
GUI_Line这个函数发出来看看呢
void GUI_Line(u16 x0, u16 y0, u16 x1, u16 y1,u16 color)
{
u16 x,y;
u16 dx;// = abs(x1 - x0);
u16 dy;// = abs(y1 - y0);
if(y0==y1)
{
if(x0<=x1)
{
x=x0;
}
else
{
x=x1;
x1=x0;
}
while(x <= x1)
{
LCD_DrawPoint1(x,y0,color);
x++;
}
return;
}
else if(y0>y1)
{
dy=y0-y1;
}
else
{
dy=y1-y0;
}
if(x0==x1)
{
if(y0<=y1)
{
y=y0;
}
else
{
y=y1;
y1=y0;
}
while(y <= y1)
{
LCD_DrawPoint1(x0,y,color);
y++;
}
return;
}
else if(x0 > x1)
{
dx=x0-x1;
x = x1;
x1 = x0;
y = y1;
y1 = y0;
}
else
{
dx=x1-x0;
x = x0;
y = y0;
}
if(dx == dy)
{
while(x <= x1)
{
x++;
if(y>y1)
{
y--;
}
else
{
y++;
}
LCD_DrawPoint1(x,y,color);
}
}
else
{
LCD_DrawPoint1(x, y, color);
if(y < y1)
{
if(dx > dy)
{
s16 p = dy * 2 - dx;
s16 twoDy = 2 * dy;
s16 twoDyMinusDx = 2 * (dy - dx);
while(x < x1)
{
x++;
if(p < 0)
{
p += twoDy;
}
else
{
y++;
p += twoDyMinusDx;
}
LCD_DrawPoint1(x, y,color);
}
}
else
{
s16 p = dx * 2 - dy;
s16 twoDx = 2 * dx;
s16 twoDxMinusDy = 2 * (dx - dy);
while(y < y1)
{
y++;
if(p < 0)
{
p += twoDx;
}
else
{
x++;
p+= twoDxMinusDy;
}
LCD_DrawPoint1(x, y, color);
}
}
}
else
{
if(dx > dy)
{
s16 p = dy * 2 - dx;
s16 twoDy = 2 * dy;
s16 twoDyMinusDx = 2 * (dy - dx);
while(x < x1)
{
x++;
if(p < 0)
{
p += twoDy;
}
else
{
y--;
p += twoDyMinusDx;
}
LCD_DrawPoint1(x, y,color);
}
}
else
{
s16 p = dx * 2 - dy;
s16 twoDx = 2 * dx;
s16 twoDxMinusDy = 2 * (dx - dy);
while(y1 < y)
{
y--;
if(p < 0)
{
p += twoDx;
}
else
{
x++;
p+= twoDxMinusDy;
}
LCD_DrawPoint1(x, y,color);
}
}
}
}
}
一周热门 更多>