]> Shamusworld >> Repos - ttedit/blobdiff - src/glyphpoints.cpp
Added rectangle point selection, canvas zooming.
[ttedit] / src / glyphpoints.cpp
index 0b0575253914002506c9186279f2b0a2c37a9d1b..4ae01e5d5d8630c0d9dcec1cfd0d6cb0689db0f4 100755 (executable)
@@ -10,7 +10,7 @@
 // JLH = James L. Hammons <jlhamm@acm.org>
 //
 // Who  When        What
-// ---  ----------  ------------------------------------------------------------
+// ---  ----------  -----------------------------------------------------------
 // JLH  ??/??/200?  Created this file
 // JLH  05/18/2004  Added pure point adding, inserting, better polygon handling
 //
@@ -247,6 +247,7 @@ void GlyphPoints::Clear(void)
 
 void GlyphPoints::InsertPoint(uint16_t pt, int xx, int yy, bool oc)
 {
+//wouldn't it be better to treat this case as inserting at the end?
        if (pt > numPoints)                                                     // > because we can insert at end...!
                throw GP_OUT_OF_RANGE;
 
@@ -267,7 +268,6 @@ void GlyphPoints::InsertPoint(uint16_t pt, int xx, int yy, bool oc)
 //we're adding to the end of the structure: [DONE, below]
        int polyInsert = (pt == numPoints ? numPolys - 1 : GetPoly(pt));
        for(int i=polyInsert; i<numPolys; i++)
-//     for(int i=GetPoly(pt); i<numPolys; i++)
                polyEnd[i]++;                                                   // Bump polygons' end point
 
        numPoints++;
@@ -379,6 +379,22 @@ WriteLogMsg("Exception: GetY(uint16_t). pt=%u, numPoints=%u\xD\xA", pt, numPoint
 }
 
 
+Vector GlyphPoints::GetXY(uint16_t pt)
+{
+       if (pt >= numPoints)
+#ifdef DEBUG
+{
+WriteLogMsg("Exception: GetXY(uint16_t). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
+#endif
+               throw GP_OUT_OF_RANGE;
+#ifdef DEBUG
+}
+#endif
+
+       return Vector(x[pt], y[pt]);
+}
+
+
 bool GlyphPoints::GetOnCurve(uint16_t pt)
 {
        if (pt >= numPoints)