取消代码中utf8的编码转换
This commit is contained in:
@@ -42,7 +42,7 @@ void WIN_DrawPointSafe (int x,int y,int mode)
|
||||
// LCD_DrawPointSafe (x,y,0);
|
||||
ewin->lcd->drawPoint(x,y,mode);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void WIN_DrawPointNormal (int x,int y,int mode)
|
||||
@@ -58,7 +58,7 @@ void WIN_DrawPointColorSafe (int x,int y,u32 color)
|
||||
{
|
||||
ewin->lcd->drawPointColor(x,y,color);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void WIN_DrawPointColorNormal (int x,int y,u32 color)
|
||||
@@ -165,7 +165,7 @@ void WIN_DrawTxtCenterAtRect (char *txt,int x,int y,int x_size,int y_size)
|
||||
char *txt_ptr=txtbuff;
|
||||
while (*txt)
|
||||
{
|
||||
if (line_i>=line_max)
|
||||
if (line_i>=line_max)
|
||||
{line_i--;break;}
|
||||
if ((*txt&0x80)==0)
|
||||
{
|
||||
@@ -175,7 +175,7 @@ void WIN_DrawTxtCenterAtRect (char *txt,int x,int y,int x_size,int y_size)
|
||||
line_i++;
|
||||
txt_ptr=txtbuff+(char_max+1)*line_i;
|
||||
x_s=x;
|
||||
if (*txt=='\n')
|
||||
if (*txt=='\n')
|
||||
{ txt++; }
|
||||
continue;
|
||||
}
|
||||
@@ -268,42 +268,42 @@ void WIN_DrawVLine (int x,int y_s,int y_e)
|
||||
|
||||
|
||||
|
||||
//画线 x1,y1:起点坐标 x2,y2:终点坐标
|
||||
//画线 x1,y1:起点坐标 x2,y2:终点坐标
|
||||
void WIN_DrawLine(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int t;
|
||||
int xerr=0,yerr=0,delta_x,delta_y,distance;
|
||||
int incx,incy,uRow,uCol;
|
||||
delta_x=x2-x1; //计算坐标增量
|
||||
delta_y=y2-y1;
|
||||
uRow=x1;
|
||||
uCol=y1;
|
||||
if(delta_x>0)incx=1; //设置单步方向
|
||||
else if(delta_x==0)incx=0;//垂直线
|
||||
else {incx=-1;delta_x=-delta_x;}
|
||||
if(delta_y>0)incy=1;
|
||||
else if(delta_y==0)incy=0;//水平线
|
||||
else{incy=-1;delta_y=-delta_y;}
|
||||
if( delta_x>delta_y)distance=delta_x; //选取基本增量坐标轴
|
||||
else distance=delta_y;
|
||||
for(t=0;t<=distance+1;t++ )//画线输出
|
||||
{
|
||||
int t;
|
||||
int xerr=0,yerr=0,delta_x,delta_y,distance;
|
||||
int incx,incy,uRow,uCol;
|
||||
delta_x=x2-x1; //计算坐标增量
|
||||
delta_y=y2-y1;
|
||||
uRow=x1;
|
||||
uCol=y1;
|
||||
if(delta_x>0)incx=1; //设置单步方向
|
||||
else if(delta_x==0)incx=0;//垂直线
|
||||
else {incx=-1;delta_x=-delta_x;}
|
||||
if(delta_y>0)incy=1;
|
||||
else if(delta_y==0)incy=0;//水平线
|
||||
else{incy=-1;delta_y=-delta_y;}
|
||||
if( delta_x>delta_y)distance=delta_x; //选取基本增量坐标轴
|
||||
else distance=delta_y;
|
||||
for(t=0;t<=distance+1;t++ )//画线输出
|
||||
{
|
||||
//WIN_GetWinStruct()->drawPoint (uRow,uCol,1);
|
||||
WIN_DrawPointSafe (uRow,uCol,1);
|
||||
xerr+=delta_x ;
|
||||
yerr+=delta_y ;
|
||||
if(xerr>distance)
|
||||
{
|
||||
xerr-=distance;
|
||||
uRow+=incx;
|
||||
}
|
||||
if(yerr>distance)
|
||||
{
|
||||
yerr-=distance;
|
||||
uCol+=incy;
|
||||
}
|
||||
}
|
||||
}
|
||||
xerr+=delta_x ;
|
||||
yerr+=delta_y ;
|
||||
if(xerr>distance)
|
||||
{
|
||||
xerr-=distance;
|
||||
uRow+=incx;
|
||||
}
|
||||
if(yerr>distance)
|
||||
{
|
||||
yerr-=distance;
|
||||
uCol+=incy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ void WIN_DrawCircle(int x0,int y0,int r)
|
||||
int di;
|
||||
int c_x=0;
|
||||
int c_y=0;
|
||||
a=0;b=r;
|
||||
a=0;b=r;
|
||||
di=3-(r<<1); //判断下个点位置的标志
|
||||
while(a<=b)
|
||||
{
|
||||
@@ -337,15 +337,15 @@ void WIN_DrawCircle(int x0,int y0,int r)
|
||||
c_x=x0-b;c_y=y0-a;
|
||||
WIN_DrawPointSafe (c_x,c_y,1);
|
||||
a++;
|
||||
//使用Bresenham算法画圆
|
||||
if(di<0)di +=4*a+6;
|
||||
//使用Bresenham算法画圆
|
||||
if(di<0)di +=4*a+6;
|
||||
else
|
||||
{
|
||||
di+=10+4*(a-b);
|
||||
di+=10+4*(a-b);
|
||||
b--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -399,7 +399,7 @@ void WIN_DrawRect (int x,int y,int x_size,int y_size)
|
||||
WIN_PlaneAAStruct *WIN_CreatPlaneAA(int x,int y,int x_size,int y_size,int accuracy)
|
||||
{
|
||||
WIN_PlaneAAStruct *ret=mymalloc(sizeof(WIN_PlaneAAStruct)+x_size*y_size);
|
||||
|
||||
|
||||
if(ret)
|
||||
{
|
||||
ret->x=x;
|
||||
@@ -452,22 +452,22 @@ void WIN_DrawPointAA(WIN_PlaneAAStruct *p,int x,int y)
|
||||
int x_e=x_s+1;int y_e=y_s+1;
|
||||
if(x_s<p->x||x_s>p->x+p->x_size-1) return;
|
||||
if(y_s<p->y||y_s>p->y+p->y_size-1) return;
|
||||
|
||||
|
||||
//每个像素的细分程度,除以一个p->accuracy是这个虚拟像素在实际像素里的分量
|
||||
//再除以一个p->accuracy是因为上层步进值
|
||||
int accuracy=p->accuracy;//*p->accuracy;
|
||||
int accuracy=p->accuracy;//*p->accuracy;
|
||||
int alpha_x=16-(x%p->accuracy)*16/p->accuracy;
|
||||
int alpha_y=16-(y%p->accuracy)*16/p->accuracy;
|
||||
|
||||
|
||||
u8 *point=0;
|
||||
int point_=0;
|
||||
|
||||
|
||||
|
||||
|
||||
point=&p->alpha[p->x_size*(y_s-p->y)+(x_s-p->x)];
|
||||
point_=*point+alpha_x*alpha_y/accuracy;
|
||||
if(point_>0xff) point_=0xff;
|
||||
*point=point_;
|
||||
|
||||
|
||||
if(x_e<p->x+p->x_size)
|
||||
{
|
||||
point=&p->alpha[p->x_size*(y_s-p->y)+(x_e-p->x)];
|
||||
@@ -494,46 +494,46 @@ void WIN_DrawPointAA(WIN_PlaneAAStruct *p,int x,int y)
|
||||
|
||||
|
||||
|
||||
//在平面内画线 x1,y1:起点坐标 x2,y2:终点坐标
|
||||
//在平面内画线 x1,y1:起点坐标 x2,y2:终点坐标
|
||||
static void WIN_PlaneDrawLine(WIN_PlaneAAStruct *p,int x1, int y1, int x2, int y2)
|
||||
{
|
||||
if(p==0) return;
|
||||
|
||||
|
||||
int t;
|
||||
int xerr=0,yerr=0,delta_x,delta_y,distance;
|
||||
int incx,incy,uRow,uCol;
|
||||
delta_x=x2-x1; //计算坐标增量
|
||||
delta_y=y2-y1;
|
||||
uRow=x1;
|
||||
uCol=y1;
|
||||
if(delta_x>0)incx=1; //设置单步方向
|
||||
else if(delta_x==0)incx=0;//垂直线
|
||||
else {incx=-1;delta_x=-delta_x;}
|
||||
if(delta_y>0)incy=1;
|
||||
else if(delta_y==0)incy=0;//水平线
|
||||
else{incy=-1;delta_y=-delta_y;}
|
||||
if( delta_x>delta_y)distance=delta_x; //选取基本增量坐标轴
|
||||
else distance=delta_y;
|
||||
for(t=0;t<=distance+1;t++ )//画线输出
|
||||
{
|
||||
|
||||
int t;
|
||||
int xerr=0,yerr=0,delta_x,delta_y,distance;
|
||||
int incx,incy,uRow,uCol;
|
||||
delta_x=x2-x1; //计算坐标增量
|
||||
delta_y=y2-y1;
|
||||
uRow=x1;
|
||||
uCol=y1;
|
||||
if(delta_x>0)incx=1; //设置单步方向
|
||||
else if(delta_x==0)incx=0;//垂直线
|
||||
else {incx=-1;delta_x=-delta_x;}
|
||||
if(delta_y>0)incy=1;
|
||||
else if(delta_y==0)incy=0;//水平线
|
||||
else{incy=-1;delta_y=-delta_y;}
|
||||
if( delta_x>delta_y)distance=delta_x; //选取基本增量坐标轴
|
||||
else distance=delta_y;
|
||||
for(t=0;t<=distance+1;t++ )//画线输出
|
||||
{
|
||||
WIN_DrawPointAA(p,uRow,uCol);
|
||||
xerr+=delta_x ;
|
||||
yerr+=delta_y ;
|
||||
if(xerr>distance)
|
||||
{
|
||||
xerr-=distance;
|
||||
uRow+=incx;
|
||||
}
|
||||
if(yerr>distance)
|
||||
{
|
||||
yerr-=distance;
|
||||
uCol+=incy;
|
||||
}
|
||||
}
|
||||
xerr+=delta_x ;
|
||||
yerr+=delta_y ;
|
||||
if(xerr>distance)
|
||||
{
|
||||
xerr-=distance;
|
||||
uRow+=incx;
|
||||
}
|
||||
if(yerr>distance)
|
||||
{
|
||||
yerr-=distance;
|
||||
uCol+=incy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//抗锯齿画线
|
||||
@@ -545,7 +545,7 @@ void WIN_DrawLineAA(int x1, int y1, int x2, int y2,int accuracy)
|
||||
int y_size=y1-y2;if(y_size<0) y_size=-y_size;
|
||||
x_size++;y_size++;
|
||||
WIN_PlaneAAStruct *p=WIN_CreatPlaneAA(x,y,x_size,y_size,4);
|
||||
|
||||
|
||||
if(p)
|
||||
{
|
||||
x1*=p->accuracy;
|
||||
@@ -568,13 +568,13 @@ void WIN_FillRectByColor (int x,int y,int x_size,int y_size)
|
||||
RECT_Struct r1;
|
||||
RECT_Struct r2;
|
||||
RECT_Struct ret;
|
||||
|
||||
|
||||
r1.x=x;r1.x_size=x_size;r1.y=y;r1.y_size=y_size;
|
||||
r2.x=WIN_GetWinStruct()->Invalid_x;
|
||||
r2.x_size=WIN_GetWinStruct()->Invalid_x_size;
|
||||
r2.y=WIN_GetWinStruct()->Invalid_y;
|
||||
r2.y_size=WIN_GetWinStruct()->Invalid_y_size;
|
||||
|
||||
|
||||
//绘制新矩形
|
||||
if (POS_RectIntersection(&ret,&r1,&r2))
|
||||
{
|
||||
@@ -590,13 +590,13 @@ void WIN_FillRectByColorAlpha (int x,int y,int x_size,int y_size,u8 alpha)
|
||||
RECT_Struct r1;
|
||||
RECT_Struct r2;
|
||||
RECT_Struct ret;
|
||||
|
||||
|
||||
r1.x=x;r1.x_size=x_size;r1.y=y;r1.y_size=y_size;
|
||||
r2.x=WIN_GetWinStruct()->Invalid_x;
|
||||
r2.x_size=WIN_GetWinStruct()->Invalid_x_size;
|
||||
r2.y=WIN_GetWinStruct()->Invalid_y;
|
||||
r2.y_size=WIN_GetWinStruct()->Invalid_y_size;
|
||||
|
||||
|
||||
//绘制新矩形
|
||||
if (POS_RectIntersection(&ret,&r1,&r2))
|
||||
{
|
||||
@@ -612,14 +612,14 @@ void WIN_FillRect (int x,int y,int x_size,int y_size,u16 *buff,u16 pic_x,u16 pic
|
||||
RECT_Struct r1;
|
||||
RECT_Struct r2;
|
||||
RECT_Struct ret;
|
||||
|
||||
|
||||
r1.x=x;r1.x_size=x_size;r1.y=y;r1.y_size=y_size;
|
||||
|
||||
|
||||
r2.x=WIN_GetWinStruct()->Invalid_x;
|
||||
r2.x_size=WIN_GetWinStruct()->Invalid_x_size;
|
||||
r2.y=WIN_GetWinStruct()->Invalid_y;
|
||||
r2.y_size=WIN_GetWinStruct()->Invalid_y_size;
|
||||
|
||||
|
||||
//绘制新矩形
|
||||
if (POS_RectIntersection(&ret,&r1,&r2))
|
||||
{
|
||||
@@ -641,14 +641,14 @@ void WIN_FillRectAlpha (int x,int y,int x_size,int y_size,void *buff,u16 pic_x,u
|
||||
RECT_Struct r1;
|
||||
RECT_Struct r2;
|
||||
RECT_Struct ret;
|
||||
|
||||
|
||||
r1.x=x;r1.x_size=x_size;r1.y=y;r1.y_size=y_size;
|
||||
|
||||
|
||||
r2.x=WIN_GetWinStruct()->Invalid_x;
|
||||
r2.x_size=WIN_GetWinStruct()->Invalid_x_size;
|
||||
r2.y=WIN_GetWinStruct()->Invalid_y;
|
||||
r2.y_size=WIN_GetWinStruct()->Invalid_y_size;
|
||||
|
||||
|
||||
//绘制新矩形
|
||||
if (POS_RectIntersection(&ret,&r1,&r2))
|
||||
{
|
||||
@@ -807,20 +807,20 @@ void WIN_FillPolygon(POINT_Struct *Points, int PointCount)
|
||||
//此函数效率比较低,只用于绘制小图标,绘制图片使用矩形填充函数
|
||||
void WIN_DrawImag (int x,int y,int xsize,int ysize,const u8 *buff)
|
||||
{
|
||||
|
||||
|
||||
if (buff==0) return ;
|
||||
|
||||
|
||||
u8 scan=buff[0];
|
||||
u8 gray=buff[1];
|
||||
u16 w=*((u16*)&buff[2]);
|
||||
u16 h=*((u16*)&buff[4]);
|
||||
u8 is565=buff[6];
|
||||
u8 rgb=buff[7];
|
||||
|
||||
|
||||
//必须所有参数都符合要求
|
||||
if ((scan!=0x00)||(gray!=0x10)||(w>WIN_IMAGE_MAXSIZE)||(h>WIN_IMAGE_MAXSIZE)||(is565!=0x01)||(rgb!=0x1b))
|
||||
return;
|
||||
|
||||
|
||||
u16 *imag=(u16 *)(buff+8);
|
||||
|
||||
if (xsize>w) xsize=w;
|
||||
@@ -841,20 +841,20 @@ void WIN_DrawImag (int x,int y,int xsize,int ysize,const u8 *buff)
|
||||
//绘制图标,但是不绘制指定颜色
|
||||
void WIN_DrawImagButColor (int x,int y,int xsize,int ysize,const u8 *buff,u16 color)
|
||||
{
|
||||
|
||||
|
||||
if (buff==0) return ;
|
||||
|
||||
|
||||
u8 scan=buff[0];
|
||||
u8 gray=buff[1];
|
||||
u16 w=*((u16*)&buff[2]);
|
||||
u16 h=*((u16*)&buff[4]);
|
||||
u8 is565=buff[6];
|
||||
u8 rgb=buff[7];
|
||||
|
||||
|
||||
//必须所有参数都符合要求
|
||||
if ((scan!=0x00)||(gray!=0x10)||(w>WIN_IMAGE_MAXSIZE)||(h>WIN_IMAGE_MAXSIZE)||(is565!=0x01)||(rgb!=0x1b))
|
||||
return;
|
||||
|
||||
|
||||
u16 *imag=(u16 *)(buff+8);
|
||||
|
||||
if (xsize>w) xsize=w;
|
||||
@@ -866,7 +866,7 @@ void WIN_DrawImagButColor (int x,int y,int xsize,int ysize,const u8 *buff,u16 co
|
||||
if (imag[i]!=color)
|
||||
//WIN_GetWinStruct()->drawPointColor (i+x,j,imag[i]);
|
||||
WIN_DrawPointColorSafe (i+x,j,imag[i]);
|
||||
|
||||
|
||||
}
|
||||
imag+=w;
|
||||
}
|
||||
@@ -880,20 +880,20 @@ void WIN_DrawImagButColor (int x,int y,int xsize,int ysize,const u8 *buff,u16 co
|
||||
//此函数效率比较低,只用于绘制小图标,绘制图片使用矩形填充函数
|
||||
void WIN_DrawImagByColor (int x,int y,int xsize,int ysize,const u8 *buff,u16 color)
|
||||
{
|
||||
|
||||
|
||||
if (buff==0) return ;
|
||||
|
||||
|
||||
u8 scan=buff[0];
|
||||
u8 gray=buff[1];
|
||||
u16 w=*((u16*)&buff[2]);
|
||||
u16 h=*((u16*)&buff[4]);
|
||||
u8 is565=buff[6];
|
||||
u8 rgb=buff[7];
|
||||
|
||||
|
||||
//必须所有参数都符合要求
|
||||
if ((scan!=0x00)||(gray!=0x10)||(w>WIN_IMAGE_MAXSIZE)||(h>WIN_IMAGE_MAXSIZE)||(is565!=0x01)||(rgb!=0x1b))
|
||||
return;
|
||||
|
||||
|
||||
u16 *imag=(u16 *)(buff+8);
|
||||
|
||||
if (xsize>w) xsize=w;
|
||||
@@ -916,20 +916,20 @@ void WIN_DrawImagByColor (int x,int y,int xsize,int ysize,const u8 *buff,u16 col
|
||||
//此函数效率比较低,只用于绘制小图标,绘制图片使用矩形填充函数
|
||||
void WIN_DrawImagByAlpha (int x,int y,int xsize,int ysize,const u8 *buff,u16 color)
|
||||
{
|
||||
|
||||
|
||||
if (buff==0) return ;
|
||||
|
||||
|
||||
u8 scan=buff[0];
|
||||
u8 gray=buff[1];
|
||||
u16 w=*((u16*)&buff[2]);
|
||||
u16 h=*((u16*)&buff[4]);
|
||||
u8 is565=buff[6];
|
||||
u8 rgb=buff[7];
|
||||
|
||||
|
||||
//必须所有参数都符合要求
|
||||
if ((scan!=0x00)||(gray!=0x10)||(w>WIN_IMAGE_MAXSIZE)||(h>WIN_IMAGE_MAXSIZE)||(is565!=0x01)||(rgb!=0x1b))
|
||||
return;
|
||||
|
||||
|
||||
u16 *imag=(u16 *)(buff+8);
|
||||
u8 r,g,b;
|
||||
u8 alpha=0;
|
||||
@@ -968,20 +968,20 @@ void WIN_DrawImagByAlpha (int x,int y,int xsize,int ysize,const u8 *buff,u16 col
|
||||
//此函数效率比较低,只用于绘制小图标,绘制图片使用矩形填充函数
|
||||
void WIN_DrawImagByAlphaAnti (int x,int y,int xsize,int ysize,const u8 *buff,u16 color)
|
||||
{
|
||||
|
||||
|
||||
if (buff==0) return ;
|
||||
|
||||
|
||||
u8 scan=buff[0];
|
||||
u8 gray=buff[1];
|
||||
u16 w=*((u16*)&buff[2]);
|
||||
u16 h=*((u16*)&buff[4]);
|
||||
u8 is565=buff[6];
|
||||
u8 rgb=buff[7];
|
||||
|
||||
|
||||
//必须所有参数都符合要求
|
||||
if ((scan!=0x00)||(gray!=0x10)||(w>WIN_IMAGE_MAXSIZE)||(h>WIN_IMAGE_MAXSIZE)||(is565!=0x01)||(rgb!=0x1b))
|
||||
return;
|
||||
|
||||
|
||||
u16 *imag=(u16 *)(buff+8);
|
||||
u8 r,g,b;
|
||||
u8 alpha=0;
|
||||
@@ -1067,7 +1067,7 @@ void WIN_GetTxtRectSize (char *txt,int *x_size,int *y_size)
|
||||
//获得图像数据的尺寸,返回0,成功,非0,失败
|
||||
int WIN_GetImageSize (u8 *buff,int *xsize,int *ysize)
|
||||
{
|
||||
|
||||
|
||||
if (buff==0) return -1;
|
||||
u8 scan=buff[0];
|
||||
u8 gray=buff[1];
|
||||
@@ -1075,11 +1075,11 @@ int WIN_GetImageSize (u8 *buff,int *xsize,int *ysize)
|
||||
u16 h=*((u16*)&buff[4]);
|
||||
u8 is565=buff[6];
|
||||
u8 rgb=buff[7];
|
||||
|
||||
|
||||
//必须所有参数都符合要求
|
||||
if ((scan!=0x00)||(gray!=0x10)||(is565!=0x01)||(rgb!=0x1b))
|
||||
return -1;
|
||||
|
||||
|
||||
*xsize=w;
|
||||
*ysize=h;
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user