if (this == &c)
return *this; // Take care of self-assignment
-#if 0
- if (x)
- delete[] x;
-
- if (y)
- delete[] y;
-
- if (onCurve)
- delete[] onCurve;
-
- if (polyEnd)
- delete[] polyEnd;
-#endif
FreeAllocatedMemory();
AllocateAndCopy(c.numPoints, c.numPolys, c.x, c.y, c.onCurve, c.polyEnd);
}
+IPoint GlyphPoints::GetPoint(uint16 pointNumber)
+{
+ if (pointNumber > numPoints)
+ throw GP_OUT_OF_RANGE;
+
+ return IPoint(x[pointNumber], y[pointNumber]);
+}
+
+
bool GlyphPoints::GetOnCurve(uint16 poly, uint16 pt)
{
if (pt >= GetNumPoints(poly))
}
+#warning "!!! This function returns incorrect results !!!"
uint16 GlyphPoints::GetPoly(uint16 pt)
{
if (pt >= numPoints)
}
+uint16 GlyphPoints::GetPolyForPoint(IPoint point)
+{
+ uint16 poly = 0;
+
+ for(uint16 i=0; i<numPoints; i++)
+ {
+ if (i > polyEnd[poly])
+ poly++;
+
+ if (IPoint(x[i], y[i]) == point)
+ return poly;
+ }
+
+ return 0xFFFF;
+}
+
+
+uint16 GlyphPoints::GetPolyForPointNumber(uint16 pointNumber)
+{
+ // If there's only one poly, we know where the point is...
+ if (numPolys <= 1)
+ return 0;
+
+ // Otherwise, do a linear search through the polys to find the right one
+ for(uint16 i=0; i<numPolys; i++)
+ {
+ if (pointNumber >= GetPolyStart(i) && pointNumber <= polyEnd[i])
+ return i;
+ }
+
+ return 0xFFFF;
+}
+
+
//
// Rotate a point by "angle" around point "center"
//