source: trunk/poppler/mypoppler/splash/SplashXPath.h @ 44

Last change on this file since 44 was 2, checked in by Eugene Romanenko, 16 years ago

First import

File size: 2.6 KB
Line 
1//========================================================================
2//
3// SplashXPath.h
4//
5//========================================================================
6
7#ifndef SPLASHXPATH_H
8#define SPLASHXPATH_H
9
10#ifdef USE_GCC_PRAGMAS
11#pragma interface
12#endif
13
14#include "SplashTypes.h"
15
16class SplashPath;
17
18//------------------------------------------------------------------------
19// SplashXPathSeg
20//------------------------------------------------------------------------
21
22struct SplashXPathSeg {
23  SplashCoord x0, y0;           // first endpoint
24  SplashCoord x1, y1;           // second endpoint
25  SplashCoord dxdy;             // slope: delta-x / delta-y
26  SplashCoord dydx;             // slope: delta-y / delta-x
27  Guint flags;
28};
29
30#define splashXPathFirst   0x01 // first segment of a subpath
31#define splashXPathLast    0x02 // last segment of a subpath
32#define splashXPathEnd0    0x04 // first endpoint is end of an open subpath
33#define splashXPathEnd1    0x08 // second endpoint is end of an open subpath
34#define splashXPathHoriz   0x10 // segment is vertical (y0 == y1)
35                                //   (dxdy is undef)
36#define splashXPathVert    0x20 // segment is horizontal (x0 == x1)
37                                //   (dydx is undef)
38#define splashXPathFlip    0x40 // y0 > y1
39
40//------------------------------------------------------------------------
41// SplashXPath
42//------------------------------------------------------------------------
43
44class SplashXPath {
45public:
46
47  // Expands (converts to segments) and flattens (converts curves to
48  // lines) <path>.  If <closeSubpaths> is true, closes all open
49  // subpaths.
50  SplashXPath(SplashPath *path, SplashCoord flatness,
51              GBool closeSubpaths);
52
53  // Copy an expanded path.
54  SplashXPath *copy() { return new SplashXPath(this); }
55
56  ~SplashXPath();
57
58  // Sort by upper coordinate (lower y), in y-major order.
59  void sort();
60
61private:
62
63  SplashXPath();
64  SplashXPath(SplashXPath *xPath);
65  void grow(int nSegs);
66  void addCurve(SplashCoord x0, SplashCoord y0,
67                SplashCoord x1, SplashCoord y1,
68                SplashCoord x2, SplashCoord y2,
69                SplashCoord x3, SplashCoord y3,
70                SplashCoord flatness,
71                GBool first, GBool last, GBool end0, GBool end1);
72  void addArc(SplashCoord x0, SplashCoord y0,
73              SplashCoord x1, SplashCoord y1,
74              SplashCoord xc, SplashCoord yc,
75              SplashCoord r, int quad,
76              SplashCoord flatness,
77              GBool first, GBool last, GBool end0, GBool end1);
78  void addSegment(SplashCoord x0, SplashCoord y0,
79                  SplashCoord x1, SplashCoord y1,
80                  GBool first, GBool last, GBool end0, GBool end1);
81
82  SplashXPathSeg *segs;
83  int length, size;             // length and size of segs array
84
85  friend class SplashXPathScanner;
86  friend class SplashClip;
87  friend class Splash;
88};
89
90#endif
Note: See TracBrowser for help on using the repository browser.