+
+ if (haveZeroPoint)
+ {
+ // Rotation code
+ GlyphPoints rotated = pts;
+ rotated.RotatePoints(rotationAngle, IPoint(rotationCenter.x(), rotationCenter.y()));
+ p.setPen(QPen(QColor(255, 0, 255), 1.0, Qt::SolidLine));
+#if 0
+ for(int poly=0; poly<rotated.GetNumPolys(); poly++)
+ {
+ if (rotated.GetNumPoints(poly) > 2)
+ {
+ // Initial move...
+ // If it's not on curve, then move to it, otherwise move to last point...
+
+ int x, y;
+
+ if (rotated.GetOnCurve(poly, rotated.GetNumPoints(poly) - 1))
+ x = (int)rotated.GetX(poly, rotated.GetNumPoints(poly) - 1), y = (int)rotated.GetY(poly, rotated.GetNumPoints(poly) - 1);
+ else
+ x = (int)rotated.GetX(poly, 0), y = (int)rotated.GetY(poly, 0);
+
+ for(int i=0; i<rotated.GetNumPoints(poly); i++)
+ {
+ if (rotated.GetOnCurve(poly, i))
+ // LineTo(hdc, rotated.GetX(poly, i), rotated.GetY(poly, i));
+ {
+ p.drawLine(x, y, rotated.GetX(poly, i), rotated.GetY(poly, i));
+ x = (int)rotated.GetX(poly, i), y = (int)rotated.GetY(poly, i);
+ }
+ else
+ {
+ uint32 prev = rotated.GetPrev(poly, i), next = rotated.GetNext(poly, i);
+ float px = rotated.GetX(poly, prev), py = rotated.GetY(poly, prev),
+ nx = rotated.GetX(poly, next), ny = rotated.GetY(poly, next);
+
+ if (!rotated.GetOnCurve(poly, prev))
+ px = (px + rotated.GetX(poly, i)) / 2.0f,
+ py = (py + rotated.GetY(poly, i)) / 2.0f;
+
+ if (!rotated.GetOnCurve(poly, next))
+ nx = (nx + rotated.GetX(poly, i)) / 2.0f,
+ ny = (ny + rotated.GetY(poly, i)) / 2.0f;
+
+ Bezier(p, point(px, py), point(rotated.GetX(poly, i), rotated.GetY(poly, i)), point(nx, ny));
+ x = (int)nx, y = (int)ny;
+
+ if (rotated.GetOnCurve(poly, next))
+ i++; // Following point is on curve, so move past it
+ }
+ }
+ }
+ }
+#else
+ DrawGlyph(p, rotated);
+#endif
+ }
+}
+
+
+void EditWindow::DrawGlyph(QPainter & p, GlyphPoints & glyph)
+{
+ for(int poly=0; poly<glyph.GetNumPolys(); poly++)
+ {
+ if (glyph.GetNumPoints(poly) > 2)
+ {
+ // Initial move...
+ // If it's not on curve, then move to it, otherwise move to last point...
+
+ int x, y;
+
+ if (glyph.GetOnCurve(poly, glyph.GetNumPoints(poly) - 1))
+ x = (int)glyph.GetX(poly, glyph.GetNumPoints(poly) - 1), y = (int)glyph.GetY(poly, glyph.GetNumPoints(poly) - 1);
+ else
+ x = (int)glyph.GetX(poly, 0), y = (int)glyph.GetY(poly, 0);
+
+ for(int i=0; i<glyph.GetNumPoints(poly); i++)
+ {
+ if (glyph.GetOnCurve(poly, i))
+ {
+ p.drawLine(x, y, glyph.GetX(poly, i), glyph.GetY(poly, i));
+ x = (int)glyph.GetX(poly, i), y = (int)glyph.GetY(poly, i);
+ }
+ else
+ {
+ uint32 prev = glyph.GetPrev(poly, i), next = glyph.GetNext(poly, i);
+ float px = glyph.GetX(poly, prev), py = glyph.GetY(poly, prev),
+ nx = glyph.GetX(poly, next), ny = glyph.GetY(poly, next);
+
+ if (!glyph.GetOnCurve(poly, prev))
+ px = (px + glyph.GetX(poly, i)) / 2.0f,
+ py = (py + glyph.GetY(poly, i)) / 2.0f;
+
+ if (!glyph.GetOnCurve(poly, next))
+ nx = (nx + glyph.GetX(poly, i)) / 2.0f,
+ ny = (ny + glyph.GetY(poly, i)) / 2.0f;
+
+ Bezier(p, point(px, py), point(glyph.GetX(poly, i), glyph.GetY(poly, i)), point(nx, ny));
+ x = (int)nx, y = (int)ny;
+
+ if (glyph.GetOnCurve(poly, next))
+ i++; // Following point is on curve, so move past it
+ }
+ }
+ }
+ }