]> git.ipfire.org Git - thirdparty/cups.git/blob - pdftops/SplashXPathScanner.h
Load cups into easysw/current.
[thirdparty/cups.git] / pdftops / SplashXPathScanner.h
1 //========================================================================
2 //
3 // SplashXPathScanner.h
4 //
5 //========================================================================
6
7 #ifndef SPLASHXPATHSCANNER_H
8 #define SPLASHXPATHSCANNER_H
9
10 #include <config.h>
11
12 #ifdef USE_GCC_PRAGMAS
13 #pragma interface
14 #endif
15
16 #include "SplashTypes.h"
17
18 class SplashXPath;
19 struct SplashIntersect;
20
21 //------------------------------------------------------------------------
22 // SplashXPathScanner
23 //------------------------------------------------------------------------
24
25 class SplashXPathScanner {
26 public:
27
28 // Create a new SplashXPathScanner object. <xPathA> must be sorted.
29 SplashXPathScanner(SplashXPath *xPathA, GBool eoA);
30
31 ~SplashXPathScanner();
32
33 // Return the path's bounding box.
34 void getBBox(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA)
35 { *xMinA = xMin; *yMinA = yMin; *xMaxA = xMax; *yMaxA = yMax; }
36
37 // Return the min/max x values for the span at <y>.
38 void getSpanBounds(int y, int *spanXMin, int *spanXMax);
39
40 // Returns true if (<x>,<y>) is inside the path.
41 GBool test(int x, int y);
42
43 // Returns true if the entire span ([<x0>,<x1>], <y>) is inside the
44 // path.
45 GBool testSpan(int x0, int x1, int y);
46
47 // Returns the next span inside the path at <y>. If <y> is
48 // different than the previous call to getNextSpan, this returns the
49 // first span at <y>; otherwise it returns the next span (relative
50 // to the previous call to getNextSpan). Returns false if there are
51 // no more spans at <y>.
52 GBool getNextSpan(int y, int *x0, int *x1);
53
54 private:
55
56 void computeIntersections(int y);
57
58 SplashXPath *xPath;
59 GBool eo;
60 int xMin, yMin, xMax, yMax;
61
62 int interY; // current y value
63 int interIdx; // current index into <inter> - used by
64 // getNextSpan
65 int interCount; // current EO/NZWN counter - used by
66 // getNextSpan
67 int xPathIdx; // current index into <xPath> - used by
68 // computeIntersections
69 SplashIntersect *inter; // intersections array for <interY>
70 int interLen; // number of intersections in <inter>
71 int interSize; // size of the <inter> array
72 };
73
74 #endif