beta-0.89.2
[luatex.git] / source / libs / poppler / poppler-src / splash / SplashXPath.h
blob1c7040daa2309edab11ebfd4d7af8c283ebe5c2b
1 //========================================================================
2 //
3 // SplashXPath.h
4 //
5 //========================================================================
7 //========================================================================
8 //
9 // Modified under the Poppler project - http://poppler.freedesktop.org
11 // All changes made under the Poppler project to this file are licensed
12 // under GPL version 2 or later
14 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
16 // To see a description of the changes please see the Changelog file that
17 // came with your tarball or type make ChangeLog if you are building from git
19 //========================================================================
21 #ifndef SPLASHXPATH_H
22 #define SPLASHXPATH_H
24 #ifdef USE_GCC_PRAGMAS
25 #pragma interface
26 #endif
28 #include "SplashTypes.h"
30 class SplashPath;
31 struct SplashXPathAdjust;
33 //------------------------------------------------------------------------
35 #define splashMaxCurveSplits (1 << 10)
37 //------------------------------------------------------------------------
38 // SplashXPathSeg
39 //------------------------------------------------------------------------
41 struct SplashXPathSeg {
42 SplashCoord x0, y0; // first endpoint
43 SplashCoord x1, y1; // second endpoint
44 SplashCoord dxdy; // slope: delta-x / delta-y
45 SplashCoord dydx; // slope: delta-y / delta-x
46 Guint flags;
49 #define splashXPathHoriz 0x01 // segment is vertical (y0 == y1)
50 // (dxdy is undef)
51 #define splashXPathVert 0x02 // segment is horizontal (x0 == x1)
52 // (dydx is undef)
53 #define splashXPathFlip 0x04 // y0 > y1
55 //------------------------------------------------------------------------
56 // SplashXPath
57 //------------------------------------------------------------------------
59 class SplashXPath {
60 public:
62 // Expands (converts to segments) and flattens (converts curves to
63 // lines) <path>. Transforms all points from user space to device
64 // space, via <matrix>. If <closeSubpaths> is true, closes all open
65 // subpaths.
66 SplashXPath(SplashPath *path, SplashCoord *matrix,
67 SplashCoord flatness, GBool closeSubpaths,
68 GBool adjustLines = gFalse, int linePosI = 0);
70 // Copy an expanded path.
71 SplashXPath *copy() { return new SplashXPath(this); }
73 ~SplashXPath();
75 // Multiply all coordinates by splashAASize, in preparation for
76 // anti-aliased rendering.
77 void aaScale();
79 // Sort by upper coordinate (lower y), in y-major order.
80 void sort();
82 protected:
84 SplashXPath(SplashXPath *xPath);
85 void transform(SplashCoord *matrix, SplashCoord xi, SplashCoord yi,
86 SplashCoord *xo, SplashCoord *yo);
87 void strokeAdjust(SplashXPathAdjust *adjust,
88 SplashCoord *xp, SplashCoord *yp);
89 void grow(int nSegs);
90 void addCurve(SplashCoord x0, SplashCoord y0,
91 SplashCoord x1, SplashCoord y1,
92 SplashCoord x2, SplashCoord y2,
93 SplashCoord x3, SplashCoord y3,
94 SplashCoord flatness,
95 GBool first, GBool last, GBool end0, GBool end1);
96 void addSegment(SplashCoord x0, SplashCoord y0,
97 SplashCoord x1, SplashCoord y1);
99 SplashXPathSeg *segs;
100 int length, size; // length and size of segs array
102 friend class SplashXPathScanner;
103 friend class SplashClip;
104 friend class Splash;
107 #endif