drawing an ellipse at an arbitrary angle

Transforms the points before calling PolyBezier (see below).

Feng Yuan (Check www.fengyuan.com for source code update for Windows

Graphics Programming: Win32 GDI and DirectDraw)

This posting is provided "AS IS" with no warranties, and confers no rights.

===========================

// Drawing a full ellipse using 4 Bezier curves

BOOL EllipseToBezier(HDC hDC, int left, int top, int right, int bottom)

{

const double M = 0.55228474983;

POINT P[13];

int dx = (int) ((right - left) * (1-M) / 2);

int dy = (int) ((bottom - top) * (1-M) / 2);

P[ 0].x = right; // . . . . .

P[ 0].y = (top+bottom)/2; // 4 3 2

P[ 1].x = right; //

P[ 1].y = top + dy; // 5 1

P[ 2].x = right - dx; //

P[ 2].y = top; // 6 0,12

P[ 3].x = (left+right)/2; //

P[ 3].y = top; // 7 11

//

P[ 4].x = left + dx; // 8 9 10

P[ 4].y = top;

P[ 5].x = left;

P[ 5].y = top + dy;

P[ 6].x = left;

P[ 6].y = (top+bottom)/2;

P[ 7].x = left;

P[ 7].y = bottom - dy;

P[ 8].x = left + dx;

P[ 8].y = bottom;

P[ 9].x = (left+right)/2;

P[ 9].y = bottom;

P[10].x = right - dx;

P[10].y = bottom;

P[11].x = right;

P[11].y = bottom - dy;

P[12].x = right;

P[12].y = (top+bottom)/2;

return PolyBezier(hDC, P, 13);

Quote:

}

Quote:

> I need a routine to generate a polygonal boundary (ie a series of points)

of

> a rotated ellipse. Does anyone have a routine for that ?