Code: Select all

`void fb_draw_circle(int xc, int yc, int r, unsigned int colour) {`

int x=0;

int y=r;

int p=3-(2*r);

fb_putpixel(xc+x,yc-y,colour);

for(x=0;x<=y;x++)

{

if (p<0)

{

p+=4*x+6;

}

else

{

y--;

p+=4*(x-y)+10;

}

fb_putpixel(xc+x,yc-y,colour);

fb_putpixel(xc-x,yc-y,colour);

fb_putpixel(xc+x,yc+y,colour);

fb_putpixel(xc-x,yc+y,colour);

fb_putpixel(xc+y,yc-x,colour);

fb_putpixel(xc-y,yc-x,colour);

fb_putpixel(xc+y,yc+x,colour);

fb_putpixel(xc-y,yc+x,colour);

}

}

and I assigned PLOT modes 88 to 95 for drawing a circle:

Code: Select all

` } else if (g_mode >= 88 && g_mode < 96) {`

// Draw a circle

fb_draw_circle(g_x_pos_last1, g_y_pos_last1, g_x_pos, col);

}

Which means I have to move to the origin of the circle and then PLOT 93,R,R where R is the radius (only the x-coordinate is used, the y is ignored).

When I run a small test program to draw 16 circles I get this result:

I can't figure out why the distance between the circles is not linear. Any clues?