source: trunk/poppler/mypoppler/splash/SplashPath.h @ 250

Last change on this file since 250 was 250, checked in by Eugene Romanenko, 13 years ago

PDF plugin: poppler library updated to version 0.8.3

File size: 3.4 KB
Line 
1//========================================================================
2//
3// SplashPath.h
4//
5//========================================================================
6
7#ifndef SPLASHPATH_H
8#define SPLASHPATH_H
9
10#ifdef USE_GCC_PRAGMAS
11#pragma interface
12#endif
13
14#include "SplashTypes.h"
15
16//------------------------------------------------------------------------
17// SplashPathPoint
18//------------------------------------------------------------------------
19
20struct SplashPathPoint {
21  SplashCoord x, y;
22};
23
24//------------------------------------------------------------------------
25// SplashPath.flags
26//------------------------------------------------------------------------
27
28// first point on each subpath sets this flag
29#define splashPathFirst         0x01
30
31// last point on each subpath sets this flag
32#define splashPathLast          0x02
33
34// if the subpath is closed, its first and last points must be
35// identical, and must set this flag
36#define splashPathClosed        0x04
37
38// curve control points set this flag
39#define splashPathCurve         0x08
40
41//------------------------------------------------------------------------
42// SplashPathHint
43//------------------------------------------------------------------------
44
45struct SplashPathHint {
46  int ctrl0, ctrl1;
47  int firstPt, lastPt;
48};
49
50//------------------------------------------------------------------------
51// SplashPath
52//------------------------------------------------------------------------
53
54class SplashPath {
55public:
56
57  // Create an empty path.
58  SplashPath();
59
60  // Copy a path.
61  SplashPath *copy() { return new SplashPath(this); }
62
63  ~SplashPath();
64
65  // Append <path> to <this>.
66  void append(SplashPath *path);
67
68  // Start a new subpath.
69  SplashError moveTo(SplashCoord x, SplashCoord y);
70
71  // Add a line segment to the last subpath.
72  SplashError lineTo(SplashCoord x, SplashCoord y);
73
74  // Add a third-order (cubic) Bezier curve segment to the last
75  // subpath.
76  SplashError curveTo(SplashCoord x1, SplashCoord y1,
77                      SplashCoord x2, SplashCoord y2,
78                      SplashCoord x3, SplashCoord y3);
79
80  // Close the last subpath, adding a line segment if necessary.
81  SplashError close();
82
83  // Add a stroke adjustment hint.  The controlling segments are
84  // <ctrl0> and <ctrl1> (where segments are identified by their first
85  // point), and the points to be adjusted are <firstPt> .. <lastPt>.
86  void addStrokeAdjustHint(int ctrl0, int ctrl1, int firstPt, int lastPt);
87
88  // Add (<dx>, <dy>) to every point on this path.
89  void offset(SplashCoord dx, SplashCoord dy);
90
91  // Get the points on the path.
92  int getLength() { return length; }
93  void getPoint(int i, double *x, double *y, Guchar *f)
94    { *x = pts[i].x; *y = pts[i].y; *f = flags[i]; }
95
96  // Get the current point.
97  GBool getCurPt(SplashCoord *x, SplashCoord *y);
98
99private:
100
101  SplashPath(SplashPath *path);
102  void grow(int nPts);
103  GBool noCurrentPoint() { return curSubpath == length; }
104  GBool onePointSubpath() { return curSubpath == length - 1; }
105  GBool openSubpath() { return curSubpath < length - 1; }
106
107  SplashPathPoint *pts;         // array of points
108  Guchar *flags;                // array of flags
109  int length, size;             // length/size of the pts and flags arrays
110  int curSubpath;               // index of first point in last subpath
111
112  SplashPathHint *hints;        // list of hints
113  int hintsLength, hintsSize;
114
115  friend class SplashXPath;
116  friend class Splash;
117  // this is a temporary hack, until we read FreeType paths directly
118  friend class ArthurOutputDev;
119};
120
121#endif
Note: See TracBrowser for help on using the repository browser.