2020-01-03 19:08发布
worksnfkpynn99 发表于 2012-7-17 09:32 11.jpg (32.4 KB, 下载次数: 0) 下载附件 2012-7-17 09:32 上传 我使用的是320*240(横屏) 1、把圆分四个象限分别画1/4的圆再用直接连接(成圆角框) 2、(第四象限减第一象限)得到填充直线的长度 3、(第三象限减第二象限)得到填充直线的长度 4、再把中间的区域用矩形填充 这样就得到一个完整的圆角填充区域。
11.jpg (32.4 KB, 下载次数: 0)
下载附件
2012-7-17 09:32 上传
worksnfkpynn99 发表于 2012-7-17 09:37 22.jpg (94.21 KB, 下载次数: 0) 下载附件 2012-7-17 09:43 上传
22.jpg (94.21 KB, 下载次数: 0)
2012-7-17 09:43 上传
最多设置5个标签!
- /***********************************************************************************************************************
- * 函数名: LCD_DrawCircleRectangle
- * 参 数: x0 :X坐标
- * y0 :Y坐标
- * Length :长度
- * wide :方向(Horizontal,Vertical)
- * r :圆角半径
- * 返 回: 无
- * 功 能: 在LCD上画圆角矩形
- *************************************************************************************************************************/
- void LCD_DrawCircleRectangle(unsigned short x0,unsigned char y0,unsigned short Length,unsigned char wide,unsigned char r)
- {
- int a,b;
- int di;
- unsigned char QUA_Second_y0,QUA_Third_y0;
- unsigned short QUA_Third_x0,QUA_Four_x0;
-
- x0 = x0+r;
- y0 = y0+r;
- Length = Length-2*r;
- wide = wide-2*r;
- a=0;
- b=r;
- di=3-2*r;
- while(a<=b)
- {
- //第一象限
- LCD_DrawPoint(x0-a,y0-b); //2
- LCD_DrawPoint(x0-b,y0-a); //3
-
- //第二象限
- QUA_Second_y0 = y0+wide;
- LCD_DrawPoint(x0-a,QUA_Second_y0+b); //1
- LCD_DrawPoint(x0-b,QUA_Second_y0+a); //7
-
- //第三象限
- QUA_Third_y0 = y0+wide;
- QUA_Third_x0 = x0+Length;
- LCD_DrawPoint(QUA_Third_x0+a,QUA_Third_y0+b); //6
- LCD_DrawPoint(QUA_Third_x0+b,QUA_Third_y0+a); //4
-
- //第四象限
- QUA_Four_x0 = x0+Length;
- LCD_DrawPoint(QUA_Four_x0+a,y0-b); //5
- LCD_DrawPoint(QUA_Four_x0+b,y0-a); //0
-
- a++;
- if(di<0) di +=4*a+6;
- else
- {
- di+=10+4*(a-b);
- b--;
- }
- //LCD_DrawPoint(x0+a,y0+b);
- }
- LCD_DrawLine(x0-r,y0,wide,Vertical);//(6,10,77,Vertical);
- LCD_DrawLine(x0+r+Length,y0,wide,Vertical);//(192,10,77,Vertical);
- LCD_DrawLine(x0,y0-r,Length,Horizontal);//(6,10,186,Horizontal);
- LCD_DrawLine(x0,y0+wide+r,Length,Horizontal);//(6,87,186,Horizontal);
-
- }
- /***********************************************************************************************************************
- * 函数名: LCD_FillCircle
- * 参 数: x0 :X坐标
- * y0 :Y坐标
- * Length :长度
- * wide :方向(Horizontal,Vertical)
- * r :圆角半径
- * color :填充 {MOD}
- * 返 回: 无
- * 功 能: 用指定 {MOD}填充圆角矩形区域
- *************************************************************************************************************************/
- void LCD_FillCircle(unsigned short x0,unsigned char y0,unsigned short Length,unsigned char wide,unsigned char r,unsigned short color)
- {
- int a,b;
- int di;
- unsigned char QUA_Second_y0,QUA_Third_y0;
- unsigned short QUA_Third_x0,QUA_Four_x0;
-
- x0 = x0+r;
- y0 = y0+r;
- Length = Length-2*r;
- wide = wide-2*r;
- a=0;
- b=r;
- di=3-2*r;
- FontSet(3,color,1);
- while(a<=b)
- {
- //第一象限
- LCD_DrawPoint(x0-a,y0-b); //2
- LCD_DrawPoint(x0-b,y0-a); //3
-
- //第二象限
- QUA_Second_y0 = y0+wide;
- LCD_DrawPoint(x0-a,QUA_Second_y0+b); //1
- LCD_DrawPoint(x0-b,QUA_Second_y0+a); //7
-
- //第三象限
- QUA_Third_y0 = y0+wide;
- QUA_Third_x0 = x0+Length;
- LCD_DrawPoint(QUA_Third_x0+a,QUA_Third_y0+b); //6
- LCD_DrawPoint(QUA_Third_x0+b,QUA_Third_y0+a); //4
-
- //第四象限
- QUA_Four_x0 = x0+Length;
- LCD_DrawPoint(QUA_Four_x0+a,y0-b); //5
- LCD_DrawPoint(QUA_Four_x0+b,y0-a); //0
-
- LCD_DrawLine(x0-a,y0-b,(QUA_Four_x0+a)-(x0-a),Horizontal);
- LCD_DrawLine(x0-b,y0-a,(QUA_Four_x0+b)-(x0-b),Horizontal);
-
- LCD_DrawLine(x0-a,QUA_Second_y0+b,(QUA_Third_x0+a)-(x0-a),Horizontal);
- LCD_DrawLine(x0-b,QUA_Second_y0+a,(QUA_Four_x0+b)-(x0-b),Horizontal);
- a++;
- if(di<0) di +=4*a+6;
- else
- {
- di+=10+4*(a-b);
- b--;
- }
- }
- LCD_DrawLine(x0-r,y0,wide,Vertical);//(6,10,77,Vertical);
- LCD_DrawLine(x0+r+Length,y0,wide,Vertical);//(192,10,77,Vertical);
- LCD_DrawLine(x0,y0-r,Length,Horizontal);//(6,10,186,Horizontal);
- LCD_DrawLine(x0,y0+wide+r,Length,Horizontal);//(6,87,186,Horizontal);
-
- LCD_Fill(x0-r+1,y0,Length+2*r-1,wide,color);
- }
复制代码一周热门 更多>