Hi, I am working on a program, for which I wrote a function to draw a circle based on a given color, x and y coordinate and a radius, this function however doesn't have the possibility to be filled with this given color, no matter what I come up with, nothing really seems to do the trick, here is what I have so far:
Code:
void PlotCircle(Color color, int xcenter,int ycenter,int radius)
{
int x=0;
int y=radius;
int p=3 - 2 * radius;
while(x <= y)
{
putPixelScreen(color,xcenter+x,ycenter+y);
putPixelScreen(color,xcenter-x,ycenter+y);
putPixelScreen(color,xcenter+x,ycenter-y);
putPixelScreen(color,xcenter-x,ycenter-y);
putPixelScreen(color,xcenter+y,ycenter+x);
putPixelScreen(color,xcenter-y,ycenter+x);
putPixelScreen(color,xcenter+y,ycenter-x);
putPixelScreen(color,xcenter-y,ycenter-x);
if(p < 0)
p += 4 * x++ + 6;
else
p += 4 * (x++ - y--) + 10;
}
}
the putPixelScreen function draws one pixel from a given color and x/y coordinates to the screen
any ideas on how I can fill up the circle?