1 //========================================================================
5 //========================================================================
12 #ifdef USE_GCC_PRAGMAS
16 #include "SplashTypes.h"
18 //------------------------------------------------------------------------
20 //------------------------------------------------------------------------
22 struct SplashPathPoint {
26 //------------------------------------------------------------------------
28 //------------------------------------------------------------------------
30 // first point on each subpath sets this flag
31 #define splashPathFirst 0x01
33 // last point on each subpath sets this flag
34 #define splashPathLast 0x02
36 // if the subpath is closed, its first and last points must be
37 // identical, and must set this flag
38 #define splashPathClosed 0x04
40 // curve control points set this flag
41 #define splashPathCurve 0x08
43 // clockwise arc center points set this flag
44 #define splashPathArcCW 0x10
46 //------------------------------------------------------------------------
48 //------------------------------------------------------------------------
53 // Create an empty path.
57 SplashPath *copy() { return new SplashPath(this); }
61 // Append <path> to <this>.
62 void append(SplashPath *path);
64 // Start a new subpath.
65 SplashError moveTo(SplashCoord x, SplashCoord y);
67 // Add a line segment to the last subpath.
68 SplashError lineTo(SplashCoord x, SplashCoord y);
70 // Add a third-order (cubic) Bezier curve segment to the last
72 SplashError curveTo(SplashCoord x1, SplashCoord y1,
73 SplashCoord x2, SplashCoord y2,
74 SplashCoord x3, SplashCoord y3);
76 // Add a clockwise circular arc with center (xc, yc) and endpoint
78 SplashError arcCWTo(SplashCoord x1, SplashCoord y1,
79 SplashCoord xc, SplashCoord yc);
81 // Close the last subpath, adding a line segment if necessary.
84 // Add (<dx>, <dy>) to every point on this path.
85 void offset(SplashCoord dx, SplashCoord dy);
87 // Get the current point.
88 GBool getCurPt(SplashCoord *x, SplashCoord *y);
92 SplashPath(SplashPath *path);
94 GBool noCurrentPoint() { return curSubpath == length; }
95 GBool onePointSubpath() { return curSubpath == length - 1; }
96 GBool openSubpath() { return curSubpath < length - 1; }
98 SplashPathPoint *pts; // array of points
99 Guchar *flags; // array of flags
100 int length, size; // length/size of the pts and flags arrays
101 int curSubpath; // index of first point in last subpath
103 friend class SplashXPath;