Sat Jul 21, 2012 2:12 pm
void CircleBresenham(HDC hdc,int xc,int yc, int R,COLORREF color)
{
int x=0,y=R;
int d=1-R;
Draw8Points(hdc,xc,yc,x,y,color);
while(x<y)
{
if(d<0)
d+=2*x+2;
else
{
d+=2*(x-y)+5;
y--;
}
x++;
Draw8Points(hdc,xc,yc,x,y,color);
}
}
void Draw8Points(HDC hdc,int xc,int yc, int a, int b)
{
SetPixel(hdc, xc+a, yc+b, NULL);
SetPixel(hdc, xc-a, yc+b, NULL);
SetPixel(hdc, xc-a, yc-b, NULL);
SetPixel(hdc, xc+a, yc-b, NULL);
SetPixel(hdc, xc+b, yc+a, NULL);
SetPixel(hdc, xc-b, yc+a, NULL);
SetPixel(hdc, xc-b, yc-a, NULL);
SetPixel(hdc, xc+b, yc-a, NULL);
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.