Sat Jul 21, 2012 2:22 pm
void CircleDirect(HDC hdc,int xc,int yc, int R)
{
int x=0,y=R;
int R2=R*R;
Draw8Points(hdc,xc,yc,x,y);
while(x<y)
{
x++;
y=round(sqrt((double)(R2-x*x)));
Draw8Points(hdc,xc,yc,x,y);
}
}
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.