1 #define sgn(x) ((x<0)?-1:((x>0)?1:0)) 2 extern void plot(
int color,
int x,
int y);
3 extern void leds_ctrl(
unsigned int id,
unsigned int val);
4 extern int delay(
int ritardo);
6 #define RESOLUTION_X 160 7 #define RESOLUTION_Y 120 9 #define RESOLUTION_X 320 10 #define RESOLUTION_Y 240 13 void line(
int x1,
int y1,
int x2,
int y2,
unsigned int color)
15 int i,dx,dy,sdx,sdy,dxabs,dyabs,
x,y,px,py;
31 for(i=0; i<dxabs; i++)
45 for(i=0; i<dyabs; i++)
59 void Rect(
int left,
int top,
int right,
int bottom,
unsigned int color)
61 line(left,top,right,top,color);
62 line(left,top,left,bottom,color);
63 line(right,top,right,bottom,color);
64 line(left,bottom,right,bottom,color);
66 void RectFill(
int left,
int top,
int right,
int bottom,
unsigned int color)
69 for (currentline=top; currentline<=bottom; currentline++) {
70 line(left,currentline,right,currentline,color);
77 void Circle(
int x0,
int y0,
int radius,
unsigned int color)
79 int x = radius, y = 0;
80 int radiusError = 1-
x;
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);
90 plot(color,x + x0, -y + y0);
91 plot(color,y + x0, -x + y0);
98 radiusError+=2*(y-x+1);
103 void CircleFill(
int x0,
int y0,
int radius,
unsigned int color)
105 int x = radius, y = 0;
106 int radiusError = 1-
x;
110 line(x + x0,y + y0,-x + x0, y + y0,color);
111 line(y + x0, x + y0,y + x0, -x + y0,color);
112 line(-y + x0, x + y0,-y + x0, -x + y0,color);
113 line(-x + x0, -y + y0,x + x0, -y + y0,color);
120 radiusError+=2*(y-x+1);
132 for (x=0; x<1; x++) {
159 Rect(x,y,x+10,y+10,4);
161 Rect(x,y,x+10,y+10,0);
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)