]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | //======================================================================== |
2 | // | |
3 | // SplashXPath.h | |
4 | // | |
5 | //======================================================================== | |
6 | ||
7 | #ifndef SPLASHXPATH_H | |
8 | #define SPLASHXPATH_H | |
9 | ||
10 | #include <config.h> | |
11 | ||
12 | #ifdef USE_GCC_PRAGMAS | |
13 | #pragma interface | |
14 | #endif | |
15 | ||
16 | #include "SplashTypes.h" | |
17 | ||
18 | class SplashPath; | |
19 | ||
20 | //------------------------------------------------------------------------ | |
21 | // SplashXPathSeg | |
22 | //------------------------------------------------------------------------ | |
23 | ||
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 | |
29 | Guint flags; | |
30 | }; | |
31 | ||
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) | |
37 | // (dxdy is undef) | |
38 | #define splashXPathVert 0x20 // segment is horizontal (x0 == x1) | |
39 | // (dydx is undef) | |
40 | #define splashXPathFlip 0x40 // y0 > y1 | |
41 | ||
42 | //------------------------------------------------------------------------ | |
43 | // SplashXPath | |
44 | //------------------------------------------------------------------------ | |
45 | ||
46 | class SplashXPath { | |
47 | public: | |
48 | ||
49 | // Expands (converts to segments) and flattens (converts curves to | |
50 | // lines) <path>. If <closeSubpaths> is true, closes all open | |
51 | // subpaths. | |
52 | SplashXPath(SplashPath *path, SplashCoord flatness, | |
53 | GBool closeSubpaths); | |
54 | ||
55 | // Copy an expanded path. | |
56 | SplashXPath *copy() { return new SplashXPath(this); } | |
57 | ||
58 | ~SplashXPath(); | |
59 | ||
60 | // Sort by upper coordinate (lower y), in y-major order. | |
61 | void sort(); | |
62 | ||
63 | private: | |
64 | ||
65 | SplashXPath(); | |
66 | SplashXPath(SplashXPath *xPath); | |
67 | void grow(int nSegs); | |
68 | void addCurve(SplashCoord x0, SplashCoord y0, | |
69 | SplashCoord x1, SplashCoord y1, | |
70 | SplashCoord x2, SplashCoord y2, | |
71 | SplashCoord x3, SplashCoord y3, | |
72 | SplashCoord flatness, | |
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, | |
78 | SplashCoord flatness, | |
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); | |
83 | ||
84 | SplashXPathSeg *segs; | |
85 | int length, size; // length and size of segs array | |
86 | ||
87 | friend class SplashXPathScanner; | |
88 | friend class SplashClip; | |
89 | friend class Splash; | |
90 | }; | |
91 | ||
92 | #endif |