}*/
GlyphPoints::GlyphPoints(int nPts/*=0*/, int nPlys/*=0*/, int * xa/*=null*/, int * ya/*=null*/,
}*/
GlyphPoints::GlyphPoints(int nPts/*=0*/, int nPlys/*=0*/, int * xa/*=null*/, int * ya/*=null*/,
- bool * oca/*=null*/, uint16 * pa/*=null*/): x(NULL), y(NULL), onCurve(NULL), polyEnd(NULL)
+ bool * oca/*=null*/, uint16_t * pa/*=null*/): x(NULL), y(NULL), onCurve(NULL), polyEnd(NULL)
//GlyphPoints::GlyphPoints(int nPts, int nPlys/*=0*/, int * xa/*=null*/, int * ya/*=null*/,
//GlyphPoints::GlyphPoints(int nPts, int nPlys/*=0*/, int * xa/*=null*/, int * ya/*=null*/,
-// bool * oca/*=null*/, uint16 * pa/*=null*/): x(NULL), y(NULL), onCurve(NULL), polyEnd(NULL)
+// bool * oca/*=null*/, uint16_t * pa/*=null*/): x(NULL), y(NULL), onCurve(NULL), polyEnd(NULL)
{
AllocateAndCopy(nPts, nPlys, xa, ya, oca, pa);
if (nPlys == 0)
{
numPolys = 1;
{
AllocateAndCopy(nPts, nPlys, xa, ya, oca, pa);
if (nPlys == 0)
{
numPolys = 1;
-void GlyphPoints::AllocateAndCopy(int nPts, int nPlys, int * xa, int * ya, bool * oca, uint16 * pa)
+void GlyphPoints::AllocateAndCopy(int nPts, int nPlys, int * xa, int * ya, bool * oca, uint16_t * pa)
int * totX = new int[totPoints];
int * totY = new int[totPoints];
bool * totOnCurve = new bool[totPoints];
int * totX = new int[totPoints];
int * totY = new int[totPoints];
bool * totOnCurve = new bool[totPoints];
int * totX = new int[numPoints + 1];
int * totY = new int[numPoints + 1];
bool * totOnCurve = new bool[numPoints + 1];
int * totX = new int[numPoints + 1];
int * totY = new int[numPoints + 1];
bool * totOnCurve = new bool[numPoints + 1];
for(int i=0; i<numPoints; i++)
totX[i] = x[i], totY[i] = y[i], totOnCurve[i] = onCurve[i];
for(int i=0; i<numPoints; i++)
totX[i] = x[i], totY[i] = y[i], totOnCurve[i] = onCurve[i];
-void GlyphPoints::InsertPoint(uint16 pt, int xx, int yy, bool oc)
+void GlyphPoints::InsertPoint(uint16_t pt, int xx, int yy, bool oc)
{
InsertPoint(pt, p.x, p.y, p.onCurve);
}
{
InsertPoint(pt, p.x, p.y, p.onCurve);
}
// size counters down as needed. In the future, we'll keep track so we
// don't have to reallocate *every* damn time a point is added...
//
// size counters down as needed. In the future, we'll keep track so we
// don't have to reallocate *every* damn time a point is added...
//
-WriteLogMsg("Exception: GetNumPoints(uint16). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
+WriteLogMsg("Exception: GetNumPoints(uint16_t). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
-WriteLogMsg("Exception: GetX(uint16). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
+WriteLogMsg("Exception: GetX(uint16_t). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
-WriteLogMsg("Exception: GetY(uint16). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
+WriteLogMsg("Exception: GetY(uint16_t). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
-WriteLogMsg("Exception: GetOnCurve(uint16). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
+WriteLogMsg("Exception: GetOnCurve(uint16_t). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
-WriteLogMsg("Exception: GetX(uint16, uint16). poly= %u, pt=%u, numPoints=%u\xD\xA", poly, pt, numPoints);
+WriteLogMsg("Exception: GetX(uint16_t, uint16_t). poly= %u, pt=%u, numPoints=%u\xD\xA", poly, pt, numPoints);
-WriteLogMsg("Exception: GetY(uint16, uint16). poly= %u, pt=%u, numPoints=%u\xD\xA", poly, pt, numPoints);
+WriteLogMsg("Exception: GetY(uint16_t, uint16_t). poly= %u, pt=%u, numPoints=%u\xD\xA", poly, pt, numPoints);
{
return IPoint(GetX(poly, pt), GetY(poly, pt), GetOnCurve(poly, pt));
}
{
return IPoint(GetX(poly, pt), GetY(poly, pt), GetOnCurve(poly, pt));
}
-WriteLogMsg("Exception: GetOnCurve(uint16, uint16). poly= %u, pt=%u, numPoints=%u\xD\xA", poly, pt, numPoints);
+WriteLogMsg("Exception: GetOnCurve(uint16_t, uint16_t). poly= %u, pt=%u, numPoints=%u\xD\xA", poly, pt, numPoints);
-WriteLogMsg("Exception: GetPolyEnd(uint16). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
+WriteLogMsg("Exception: GetPolyEnd(uint16_t). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
-WriteLogMsg("Exception: GetPolyEnd(uint16). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
+WriteLogMsg("Exception: GetPolyEnd(uint16_t). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
-WriteLogMsg("Exception: GetPolyEnd(uint16). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
+WriteLogMsg("Exception: GetPolyEnd(uint16_t). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
for(int i=0; i<GetNumPoints(poly); i++)
x[polyStart + i] += xOff, y[polyStart + i] += yOff;
for(int i=0; i<GetNumPoints(poly); i++)
x[polyStart + i] += xOff, y[polyStart + i] += yOff;
-WriteLogMsg("Exception: SetXY(uint16, int, int). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
+WriteLogMsg("Exception: SetXY(uint16_t, int, int). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
-WriteLogMsg("Exception: SetOnCurve(uint16, bool). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
+WriteLogMsg("Exception: SetOnCurve(uint16_t, bool). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
-WriteLogMsg("Exception: SetPoint(uint16, IPoint). pt=%u, numPoints=%u\xD\xA", pointNum, numPoints);
+WriteLogMsg("Exception: SetPoint(uint16_t, IPoint). pt=%u, numPoints=%u\xD\xA", pointNum, numPoints);
{
// pt = 7, polyEnd = 4, 9, 15
{
// pt = 7, polyEnd = 4, 9, 15
{
return (pt == GetNumPoints(poly) - 1 ? 0 : pt + 1);
}
#warning "!!! This function returns incorrect results !!!"
{
return (pt == GetNumPoints(poly) - 1 ? 0 : pt + 1);
}
#warning "!!! This function returns incorrect results !!!"
-WriteLogMsg("Exception: GetPoly(uint16). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
+WriteLogMsg("Exception: GetPoly(uint16_t). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
- int32 x1 = GetX(poly, pt), y1 = GetY(poly, pt);
- int32 x2 = GetX(poly, prev), y2 = GetY(poly, prev);
+ int32_t x1 = GetX(poly, pt), y1 = GetY(poly, pt);
+ int32_t x2 = GetX(poly, prev), y2 = GetY(poly, prev);
- int32 x1 = GetX(poly, pt), y1 = GetY(poly, pt);
- int32 x2 = GetX(poly, next), y2 = GetY(poly, next);
+ int32_t x1 = GetX(poly, pt), y1 = GetY(poly, pt);
+ int32_t x2 = GetX(poly, next), y2 = GetY(poly, next);
return IPoint(GetX(poly, prevPt), GetY(poly, prevPt));
}
return IPoint(GetX(poly, prevPt), GetY(poly, prevPt));
}
return IPoint(GetX(poly, nextPt), GetY(poly, nextPt));
}
return IPoint(GetX(poly, nextPt), GetY(poly, nextPt));
}
{
// 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
{
// 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
{
// We should throw an exception here, but meh
// (this actually short circuits the exception handling in all the GetPolyXXX() functions)
{
// We should throw an exception here, but meh
// (this actually short circuits the exception handling in all the GetPolyXXX() functions)
-//WriteLogMsg("Exception: GetPolyEnd(uint16). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
+//WriteLogMsg("Exception: GetPolyEnd(uint16_t). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
{
IPoint rotated = RotatePoint(angle, IPoint(x[i], y[i]), centroid);
x[i] = rotated.x;
{
IPoint rotated = RotatePoint(angle, IPoint(x[i], y[i]), centroid);
x[i] = rotated.x;
// Algorithm: Step through points in the polygon, swapping 1st and last, then
// 2nd and (last - 1), 3rd and (last - 2), etc. We only do this for half the
// points, as doing it for all would undo the swapping we did in the 1st half.
// Algorithm: Step through points in the polygon, swapping 1st and last, then
// 2nd and (last - 1), 3rd and (last - 2), etc. We only do this for half the
// points, as doing it for all would undo the swapping we did in the 1st half.
}
fscanf(file, "%s %u", line, &numPolys);
}
fscanf(file, "%s %u", line, &numPolys);