1 //========================================================================
5 //========================================================================
10 #ifdef USE_GCC_PRAGMAS
14 #include "SplashTypes.h"
16 //------------------------------------------------------------------------
18 //------------------------------------------------------------------------
20 struct SplashPathPoint
{
24 //------------------------------------------------------------------------
26 //------------------------------------------------------------------------
28 // first point on each subpath sets this flag
29 #define splashPathFirst 0x01
31 // last point on each subpath sets this flag
32 #define splashPathLast 0x02
34 // if the subpath is closed, its first and last points must be
35 // identical, and must set this flag
36 #define splashPathClosed 0x04
38 // curve control points set this flag
39 #define splashPathCurve 0x08
41 //------------------------------------------------------------------------
43 //------------------------------------------------------------------------
45 struct SplashPathHint
{
50 //------------------------------------------------------------------------
52 //------------------------------------------------------------------------
57 // Create an empty path.
61 SplashPath
*copy() { return new SplashPath(this); }
65 // Append <path> to <this>.
66 void append(SplashPath
*path
);
68 // Start a new subpath.
69 SplashError
moveTo(SplashCoord x
, SplashCoord y
);
71 // Add a line segment to the last subpath.
72 SplashError
lineTo(SplashCoord x
, SplashCoord y
);
74 // Add a third-order (cubic) Bezier curve segment to the last
76 SplashError
curveTo(SplashCoord x1
, SplashCoord y1
,
77 SplashCoord x2
, SplashCoord y2
,
78 SplashCoord x3
, SplashCoord y3
);
80 // Close the last subpath, adding a line segment if necessary. If
81 // <force> is true, this adds a line segment even if the current
82 // point is equal to the first point in the subpath.
83 SplashError
close(GBool force
= gFalse
);
85 // Add a stroke adjustment hint. The controlling segments are
86 // <ctrl0> and <ctrl1> (where segments are identified by their first
87 // point), and the points to be adjusted are <firstPt> .. <lastPt>.
88 void addStrokeAdjustHint(int ctrl0
, int ctrl1
, int firstPt
, int lastPt
);
90 // Add (<dx>, <dy>) to every point on this path.
91 void offset(SplashCoord dx
, SplashCoord dy
);
93 // Get the points on the path.
94 int getLength() { return length
; }
95 void getPoint(int i
, double *x
, double *y
, Guchar
*f
)
96 { *x
= pts
[i
].x
; *y
= pts
[i
].y
; *f
= flags
[i
]; }
98 // Get the current point.
99 GBool
getCurPt(SplashCoord
*x
, SplashCoord
*y
);
103 SplashPath(SplashPath
*path
);
105 GBool
noCurrentPoint() { return curSubpath
== length
; }
106 GBool
onePointSubpath() { return curSubpath
== length
- 1; }
107 GBool
openSubpath() { return curSubpath
< length
- 1; }
109 SplashPathPoint
*pts
; // array of points
110 Guchar
*flags
; // array of flags
111 int length
, size
; // length/size of the pts and flags arrays
112 int curSubpath
; // index of first point in last subpath
114 SplashPathHint
*hints
; // list of hints
115 int hintsLength
, hintsSize
;
117 friend class SplashXPath
;
119 // this is a temporary hack, until we read FreeType paths directly
120 friend class ArthurOutputDev
;