6
* Rotatable Ellipse hack
8
* Win95 (Win32?) doesn't support rotating ellipses - so we
9
* implement them with polygons.
11
* We use a fixed number of edges rather than varying the number
12
* according to the radius of the ellipse.
13
* If anyone feels like improving the code (to vary the number),
14
* they should place a fixed upper bound on the number of edges
15
* since it takes a relatively long time to draw 1000 edges.
18
int transformedEllipse(
19
HDC hdc, LONG x0, LONG y0, LONG x1, LONG y1, LONG x2, LONG y2) {
20
static BOOL firstTime = 1;
21
static double sins[20];
22
static double coss[20];
27
double x = (x1 + x2) / 2; /* centre of parallelogram */
28
double y = (y1 + y2) / 2;
30
double dx1 = (x1 - x0) / 2; /* distance to corners from centre */
31
double dy1 = (y1 - y0) / 2;
32
double dx2 = (x2 - x0) / 2;
33
double dy2 = (y2 - y0) / 2;
37
double da = 2.0*3.14159 / 20;
38
for (i=0; i < 20; ++i, a+=da) {
44
for(i=0; i < 20; ++i) {
47
pts[i].x = x + c*dx1 + s*dx2;
48
pts[i].y = y + c*dy1 + s*dy2;
50
return Polygon(hdc,pts,20);