X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fglyphpoints.h;h=2384d7cf963a05920e9e16d68269ca7fba1ad652;hb=c84263bb8b0d16e4c6da49aa0b7d0bc904ae02b1;hp=2348d1e48f28f08aa398ba60fa78451de5495de4;hpb=5c7c36b21d0f2a88accd8ff12c05dcc3004ce0e8;p=ttedit diff --git a/src/glyphpoints.h b/src/glyphpoints.h index 2348d1e..2384d7c 100755 --- a/src/glyphpoints.h +++ b/src/glyphpoints.h @@ -1,85 +1,85 @@ -// -// glyphpoints.h -// -// by James L. Hammons -// -// This class encapsulates the data associated with a TrueType glyph. -// Data is dynamically allocated. -// - -#ifndef __GLYPHPOINTS_H__ -#define __GLYPHPOINTS_H__ - -#include "types.h" - - -struct IPoint -{ - int32 x, y; - bool onCurve; - - IPoint(int32 xx=0, int32 yy=0, bool oc=true): x(xx), y(yy), onCurve(oc) {} -}; - -// Throws the following exceptions: -#define GP_OUT_OF_RANGE 1 - -class GlyphPoints -{ - public: -//For some reason, gcc barfs here when something tries to use the copy -//constructor because it gets confused between the optional arguments (which -//start with an INT for cryin' out loud) and the GlyphPoints & argument. So, -//Let's try making it a non-optional first param, and go from there... -//Turns out the compiler barfs regardless... -//Turns out the problem was that the copy ctor wasn't declared as CONST... - GlyphPoints(int nPts = 0, int nPlys = 0, int * xa = NULL, int * ya = NULL, - bool * oca = NULL, uint16 * pa = NULL); -// GlyphPoints(void);// And now *this* is needed... Bleah! -// GlyphPoints(int nPts, int nPlys = 0, int * xa = NULL, int * ya = NULL, -// bool * oca = NULL, uint16 * pa = NULL); - GlyphPoints(int xx, int yy, bool oc); -// GlyphPoints(GlyphPoints &); // Copy constructor - GlyphPoints(const GlyphPoints &); // Copy constructor - ~GlyphPoints(); - GlyphPoints& operator=(const GlyphPoints &); - GlyphPoints operator+(const GlyphPoints &); - GlyphPoints operator+(const IPoint &); - GlyphPoints& operator+=(const IPoint &); - void InsertPoint(uint16, int, int, bool); - void InsertPoint(uint16, const IPoint &); - void DeletePoint(uint16); - uint16 GetNumPoints(void); - uint16 GetNumPoints(uint16); - uint16 GetNumPolys(void); - int GetX(uint16); - int GetY(uint16); - bool GetOnCurve(uint16); - int GetX(uint16, uint16); - int GetY(uint16, uint16); - bool GetOnCurve(uint16, uint16); - uint16 GetPolyEnd(uint16); - void OffsetPoints(int, int); - void OffsetPoly(uint16, int32, int32); - void ScalePoints(float); - void SetXY(uint16, int, int); - void SetOnCurve(uint16, bool); - uint16 GetPrev(uint16); - uint16 GetNext(uint16); - uint16 GetPrev(uint16, uint16); - uint16 GetNext(uint16, uint16); - uint16 GetPoly(uint16); - void AddNewPolyAtEnd(void); - - private: - void AllocateAndCopy(int, int, int *, int *, bool *, uint16 *); - - private: - int numPoints, numPolys; - int * x, * y; - bool * onCurve; - uint16 * polyEnd; - uint16 pointsAllocated, polysAllocated; -}; - -#endif // __GLYPHPOINTS_H__ +// +// glyphpoints.h +// +// by James L. Hammons +// +// This class encapsulates the data associated with a TrueType glyph. +// Data is dynamically allocated. +// + +#ifndef __GLYPHPOINTS_H__ +#define __GLYPHPOINTS_H__ + +#include "types.h" + + +struct IPoint +{ + int32 x, y; + bool onCurve; + + IPoint(int32 xx=0, int32 yy=0, bool oc=true): x(xx), y(yy), onCurve(oc) {} +}; + +// Throws the following exceptions: +#define GP_OUT_OF_RANGE 1 + +class GlyphPoints +{ + public: +//For some reason, gcc barfs here when something tries to use the copy +//constructor because it gets confused between the optional arguments (which +//start with an INT for cryin' out loud) and the GlyphPoints & argument. So, +//Let's try making it a non-optional first param, and go from there... +//Turns out the compiler barfs regardless... +//Turns out the problem was that the copy ctor wasn't declared as CONST... + GlyphPoints(int nPts = 0, int nPlys = 0, int * xa = NULL, int * ya = NULL, + bool * oca = NULL, uint16 * pa = NULL); +// GlyphPoints(void);// And now *this* is needed... Bleah! +// GlyphPoints(int nPts, int nPlys = 0, int * xa = NULL, int * ya = NULL, +// bool * oca = NULL, uint16 * pa = NULL); + GlyphPoints(int xx, int yy, bool oc); +// GlyphPoints(GlyphPoints &); // Copy constructor + GlyphPoints(const GlyphPoints &); // Copy constructor + ~GlyphPoints(); + GlyphPoints& operator=(const GlyphPoints &); + GlyphPoints operator+(const GlyphPoints &); + GlyphPoints operator+(const IPoint &); + GlyphPoints& operator+=(const IPoint &); + void InsertPoint(uint16, int, int, bool); + void InsertPoint(uint16, const IPoint &); + void DeletePoint(uint16); + uint16 GetNumPoints(void); + uint16 GetNumPoints(uint16); + uint16 GetNumPolys(void); + int GetX(uint16); + int GetY(uint16); + bool GetOnCurve(uint16); + int GetX(uint16, uint16); + int GetY(uint16, uint16); + bool GetOnCurve(uint16, uint16); + uint16 GetPolyEnd(uint16); + void OffsetPoints(int, int); + void OffsetPoly(uint16, int32, int32); + void ScalePoints(float); + void SetXY(uint16, int, int); + void SetOnCurve(uint16, bool); + uint16 GetPrev(uint16); + uint16 GetNext(uint16); + uint16 GetPrev(uint16, uint16); + uint16 GetNext(uint16, uint16); + uint16 GetPoly(uint16); + void AddNewPolyAtEnd(void); + + private: + void AllocateAndCopy(int, int, int *, int *, bool *, uint16 *); + + private: + int numPoints, numPolys; + int * x, * y; + bool * onCurve; + uint16 * polyEnd; + uint16 pointsAllocated, polysAllocated; +}; + +#endif // __GLYPHPOINTS_H__