// RoundRect(x1,y1,x2,y2,color)
function rrect(x1,y1,x2,y2,r,c){
function bezier2(x1,y1,x2,y2,x3,y3,c){
var t=0,ox=x1,oy=y1,x,y;
while(t<=10){
var tt=10-t;
x=tt*tt*x1+2*tt*t*x2+t*t*x3;
y=tt*tt*y1+2*tt*t*y2+t*t*y3;
x=x/100;
y=y/100;
uart(128,8,1,ox,oy,x,y,c);
ox=x;oy=y;
t=t+1;
}
}
bezier2(x1,y1+r, x1,y1, x1+r, y1,c);
uart(128,8,1,x1+r,y1,x2-r,y1,c);
bezier2(x2-r,y1, x2,y1, x2, y1+r,c);
uart(128,8,1,x2,y1+r,x2,y2-r,c);
bezier2(x2,y2-r, x2,y2, x2-r, y2,c);
uart(128,8,1,x1+r,y2,x2-r,y2,c);
bezier2(x1+r,y2, x1,y2, x1, y2-r,c);
uart(128,8,1,x1,y2-r,x1,y1+r,c);
}
// Sample Code
uart("\nPC CLEAR 00\n");
rrect(4,2,45,39,4, 3);
rrect(30,11,68,43, 11, 10);