1 //========================================================================
3 // SplashXPathScanner.h
5 //========================================================================
7 #ifndef SPLASHXPATHSCANNER_H
8 #define SPLASHXPATHSCANNER_H
12 #ifdef USE_GCC_PRAGMAS
16 #include "SplashTypes.h"
19 struct SplashIntersect;
21 //------------------------------------------------------------------------
23 //------------------------------------------------------------------------
25 class SplashXPathScanner {
28 // Create a new SplashXPathScanner object. <xPathA> must be sorted.
29 SplashXPathScanner(SplashXPath *xPathA, GBool eoA);
31 ~SplashXPathScanner();
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; }
37 // Return the min/max x values for the span at <y>.
38 void getSpanBounds(int y, int *spanXMin, int *spanXMax);
40 // Returns true if (<x>,<y>) is inside the path.
41 GBool test(int x, int y);
43 // Returns true if the entire span ([<x0>,<x1>], <y>) is inside the
45 GBool testSpan(int x0, int x1, int y);
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);
56 void computeIntersections(int y);
60 int xMin, yMin, xMax, yMax;
62 int interY; // current y value
63 int interIdx; // current index into <inter> - used by
65 int interCount; // current EO/NZWN counter - used by
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