算法一, // 中点画圆法 // 绘制x从0到等于radium/2的八分之一圆弧,其余部分通过对称完成 void circleMidpoint(int xCenter, int yCenter, int radium, HDC hDC, COLORREF crColor) { int x = 0, y = radium; // 初始点为(0, radium) int p = 1 - radium; // 本来初始值是1.25 - radium,但整数嘛,取消掉0.25是不会影响正负方向判断的 SetPixel(hDC, xCenter, yCenter + radium, crColor); SetPixel(hDC, xCenter, yCenter - radium, crColor); SetPixel(hDC, xCenter + radium, yCenter, crColor); SetPixel(hDC, xCenter - radium, yCenter, crColor); for (x = 1; x < y; x++) { if (p < 0) p += 2 * x + 1; else { y--; p += 2 * (x - y) + 1; } SetPixel(hDC, xCenter + x, yCenter + y, crColor); SetPixel(hDC, xCenter - x, yCenter + y, crColor); SetPixel(hDC, xCenter + x, yCenter - y, crColor); SetPixel(hDC, xCenter - x, yCenter - y, crColor); SetPixel(hDC, xCenter + y, yCenter + x, crColor); SetPixel(hDC, xCenter - y, yCenter + x, crColor); SetPixel(hDC, xCenter + y, yCenter - x,