7 #define sgn(x) ((x<0)?-1:((x>0)?1:0)) 8 #define RESOLUTION_X 640 9 #define RESOLUTION_Y 480 11 void line(
int x1,
int y1,
int x2,
int y2,
unsigned int color)
13 int i,dx,dy,sdx,sdy,dxabs,dyabs,
x,y,px,py;
29 for(i=0; i<dxabs; i++)
43 for(i=0; i<dyabs; i++)
57 void Rect(
int left,
int top,
int right,
int bottom,
unsigned int color)
59 line(left,top,right,top,color);
60 line(left,top,left,bottom,color);
61 line(right,top,right,bottom,color);
62 line(left,bottom,right,bottom,color);
64 void RectFill(
int left,
int top,
int right,
int bottom,
unsigned int color)
67 for (currentline=top; currentline<=bottom; currentline++) {
68 line(left,currentline,right,currentline,color);
75 void Circle(
int x0,
int y0,
int radius,
unsigned int color)
77 int x = radius, y = 0;
78 int radiusError = 1-
x;
82 plot(color,x + x0, y + y0);
83 plot(color,y + x0, x + y0);
84 plot(color,-x + x0, y + y0);
85 plot(color,-y + x0, x + y0);
86 plot(color,-x + x0, -y + y0);
87 plot(color,-y + x0, -x + y0);
88 plot(color,x + x0, -y + y0);
89 plot(color,y + x0, -x + y0);
96 radiusError+=2*(y-x+1);
101 void CircleFill(
int x0,
int y0,
int radius,
unsigned int color)
103 int x = radius, y = 0;
104 int radiusError = 1-
x;
108 line(x + x0,y + y0,-x + x0, y + y0,color);
109 line(y + x0, x + y0,y + x0, -x + y0,color);
110 line(-y + x0, x + y0,-y + x0, -x + y0,color);
111 line(-x + x0, -y + y0,x + x0, -y + y0,color);
118 radiusError+=2*(y-x+1);
129 for (x=0; x<1; x++) {
134 for (y=0; y<1; y++) {
138 unsigned short color =
sw_ctrl();
140 if(color==0) color = 7;
141 if(color>7) color = 7;
144 if(radius < 8) radius = 8;
145 if(radius > 31) radius = 31;
void * top(node_stack *head)
void Rect(int left, int top, int right, int bottom, unsigned int color)
void plot(int color, int x, int y)
void line(int x1, int y1, int x2, int y2, unsigned int color)
void CircleFill(int x0, int y0, int radius, unsigned int color)
static const uint32_t k[]
void Circle(int x0, int y0, int radius, unsigned int color)
void leds_ctrl(unsigned int id, unsigned int val)
x
Return the smallest n such that 2^n >= _x.
void RectFill(int left, int top, int right, int bottom, unsigned int color)