]> www.fi.muni.cz Git - evince.git/blob - pdf/splash/SplashPath.h
Fix CID fonts with freetype 2.1.9
[evince.git] / pdf / splash / SplashPath.h
1 //========================================================================
2 //
3 // SplashPath.h
4 //
5 //========================================================================
6
7 #ifndef SPLASHPATH_H
8 #define SPLASHPATH_H
9
10 #include <aconf.h>
11
12 #ifdef USE_GCC_PRAGMAS
13 #pragma interface
14 #endif
15
16 #include "SplashTypes.h"
17
18 //------------------------------------------------------------------------
19 // SplashPathPoint
20 //------------------------------------------------------------------------
21
22 struct SplashPathPoint {
23   SplashCoord x, y;
24 };
25
26 //------------------------------------------------------------------------
27 // SplashPath.flags
28 //------------------------------------------------------------------------
29
30 // first point on each subpath sets this flag
31 #define splashPathFirst  0x01
32
33 // last point on each subpath sets this flag
34 #define splashPathLast   0x02
35
36 // if the subpath is closed, its first and last points must be
37 // identical, and must set this flag
38 #define splashPathClosed 0x04
39
40 // curve control points set this flag
41 #define splashPathCurve  0x08
42
43 // clockwise arc center points set this flag
44 #define splashPathArcCW  0x10
45
46 //------------------------------------------------------------------------
47 // SplashPath
48 //------------------------------------------------------------------------
49
50 class SplashPath {
51 public:
52
53   // Create an empty path.
54   SplashPath();
55
56   // Copy a path.
57   SplashPath *copy() { return new SplashPath(this); }
58
59   ~SplashPath();
60
61   // Append <path> to <this>.
62   void append(SplashPath *path);
63
64   // Start a new subpath.
65   SplashError moveTo(SplashCoord x, SplashCoord y);
66
67   // Add a line segment to the last subpath.
68   SplashError lineTo(SplashCoord x, SplashCoord y);
69
70   // Add a third-order (cubic) Bezier curve segment to the last
71   // subpath.
72   SplashError curveTo(SplashCoord x1, SplashCoord y1,
73                       SplashCoord x2, SplashCoord y2,
74                       SplashCoord x3, SplashCoord y3);
75
76   // Add a clockwise circular arc with center (xc, yc) and endpoint
77   // (x1, y1).
78   SplashError arcCWTo(SplashCoord x1, SplashCoord y1,
79                       SplashCoord xc, SplashCoord yc);
80
81   // Close the last subpath, adding a line segment if necessary.
82   SplashError close();
83
84   // Add (<dx>, <dy>) to every point on this path.
85   void offset(SplashCoord dx, SplashCoord dy);
86
87   // Get the current point.
88   GBool getCurPt(SplashCoord *x, SplashCoord *y);
89
90 private:
91
92   SplashPath(SplashPath *path);
93   void grow(int nPts);
94   GBool noCurrentPoint() { return curSubpath == length; }
95   GBool onePointSubpath() { return curSubpath == length - 1; }
96   GBool openSubpath() { return curSubpath < length - 1; }
97
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
102
103   friend class SplashXPath;
104   friend class Splash;
105 };
106
107 #endif