Dot-point Bresenham algorithm rasterized elliptical painting (quartile method)
Void Bresenham_Ellipse (CDC * pDC, int ox, int oy, int a, int B) // center x, center y, horizontal length, longitudinal length {float d = B * B + a * (-B + 0.25); int x = 0, y = B, fx = a * a/sqrt (float) a * a + B * B); while (x! = Fx) {if (d <0) d + = B * (2 * x + 3); else {-- y; d + = B * (2 * x + 3) + a * (-2 * y + 2);} ++ x; pDC-> SetPixel (ox + x, oy + y, RGB (0, 0,225); pDC-> SetPixel (ox-x, oy + y, RGB (0, (0,225); pDC-> SetPixel (ox + x, oy-y, RGB (0, 0,225); pDC-> SetPixel (ox-x, oy-y, RGB (0, 0,225);} // The midpoint is changed to (x + 0.5, Y-1) So d = B * (x + 0.5) * (x + 0.5) + a * (y-1) * (y-1)-a * B; while (y> 0) {if (d <0) {+ x; d + = B * (2 * x + 2) + a * (-2 * y + 3 );} elsed + = a * (-2 * y + 3); -- y; pDC-> SetPixel (ox + x, oy + y, RGB (0, 0,225 )); pDC-> SetPixel (ox-x, oy + y, RGB (0, 0,225); pDC-> SetPixel (ox + x, oy-y, RGB (0, 0,225); pDC-> SetPixel (ox-x, oy-y, RGB (0, 0,225 ));}}