1 //========================================================================
5 //========================================================================
12 #ifdef USE_GCC_PRAGMAS
16 #include "SplashTypes.h"
20 //------------------------------------------------------------------------
22 //------------------------------------------------------------------------
24 struct SplashXPathSeg {
25 SplashCoord x0, y0; // first endpoint
26 SplashCoord x1, y1; // second endpoint
27 SplashCoord dxdy; // slope: delta-x / delta-y
28 SplashCoord dydx; // slope: delta-y / delta-x
32 #define splashXPathFirst 0x01 // first segment of a subpath
33 #define splashXPathLast 0x02 // last segment of a subpath
34 #define splashXPathEnd0 0x04 // first endpoint is end of an open subpath
35 #define splashXPathEnd1 0x08 // second endpoint is end of an open subpath
36 #define splashXPathHoriz 0x10 // segment is vertical (y0 == y1)
38 #define splashXPathVert 0x20 // segment is horizontal (x0 == x1)
40 #define splashXPathFlip 0x40 // y0 > y1
42 //------------------------------------------------------------------------
44 //------------------------------------------------------------------------
49 // Expands (converts to segments) and flattens (converts curves to
50 // lines) <path>. If <closeSubpaths> is true, closes all open
52 SplashXPath(SplashPath *path, SplashCoord flatness,
55 // Copy an expanded path.
56 SplashXPath *copy() { return new SplashXPath(this); }
60 // Sort by upper coordinate (lower y), in y-major order.
66 SplashXPath(SplashXPath *xPath);
68 void addCurve(SplashCoord x0, SplashCoord y0,
69 SplashCoord x1, SplashCoord y1,
70 SplashCoord x2, SplashCoord y2,
71 SplashCoord x3, SplashCoord y3,
73 GBool first, GBool last, GBool end0, GBool end1);
74 void addArc(SplashCoord x0, SplashCoord y0,
75 SplashCoord x1, SplashCoord y1,
76 SplashCoord xc, SplashCoord yc,
77 SplashCoord r, int quad,
79 GBool first, GBool last, GBool end0, GBool end1);
80 void addSegment(SplashCoord x0, SplashCoord y0,
81 SplashCoord x1, SplashCoord y1,
82 GBool first, GBool last, GBool end0, GBool end1);
85 int length, size; // length and size of segs array
87 friend class SplashXPathScanner;
88 friend class SplashClip;