beta-0.89.2
[luatex.git] / source / libs / poppler / poppler-src / splash / SplashXPathScanner.h
blobcc295cb68fede84c6a8e038103534a68b55b42a6
1 //========================================================================
2 //
3 // SplashXPathScanner.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, 2014 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 SPLASHXPATHSCANNER_H
22 #define SPLASHXPATHSCANNER_H
24 #ifdef USE_GCC_PRAGMAS
25 #pragma interface
26 #endif
28 #include "SplashTypes.h"
30 class SplashXPath;
31 class SplashBitmap;
32 struct SplashIntersect;
34 //------------------------------------------------------------------------
35 // SplashXPathScanner
36 //------------------------------------------------------------------------
38 class SplashXPathScanner {
39 public:
41 // Create a new SplashXPathScanner object. <xPathA> must be sorted.
42 SplashXPathScanner(SplashXPath *xPathA, GBool eoA,
43 int clipYMin, int clipYMax);
45 ~SplashXPathScanner();
47 // Return the path's bounding box.
48 void getBBox(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA)
49 { *xMinA = xMin; *yMinA = yMin; *xMaxA = xMax; *yMaxA = yMax; }
51 // Return the path's bounding box.
52 void getBBoxAA(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA);
54 // Returns true if at least part of the path was outside the
55 // clipYMin/clipYMax bounds passed to the constructor.
56 GBool hasPartialClip() { return partialClip; }
58 // Return the min/max x values for the span at <y>.
59 void getSpanBounds(int y, int *spanXMin, int *spanXMax);
61 // Returns true if (<x>,<y>) is inside the path.
62 GBool test(int x, int y);
64 // Returns true if the entire span ([<x0>,<x1>], <y>) is inside the
65 // path.
66 GBool testSpan(int x0, int x1, int y);
68 // Returns the next span inside the path at <y>. If <y> is
69 // different than the previous call to getNextSpan, this returns the
70 // first span at <y>; otherwise it returns the next span (relative
71 // to the previous call to getNextSpan). Returns false if there are
72 // no more spans at <y>.
73 GBool getNextSpan(int y, int *x0, int *x1);
75 // Renders one anti-aliased line into <aaBuf>. Returns the min and
76 // max x coordinates with non-zero pixels in <x0> and <x1>.
77 void renderAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y,
78 GBool adjustVertLine = gFalse);
80 // Clips an anti-aliased line by setting pixels to zero. On entry,
81 // all non-zero pixels are between <x0> and <x1>. This function
82 // will update <x0> and <x1>.
83 void clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y);
85 private:
87 void computeIntersections();
88 GBool addIntersection(double segYMin, double segYMax,
89 Guint segFlags,
90 int y, int x0, int x1);
92 SplashXPath *xPath;
93 GBool eo;
94 int xMin, yMin, xMax, yMax;
95 GBool partialClip;
97 SplashIntersect *allInter; // array of intersections
98 int allInterLen; // number of intersections in <allInter>
99 int allInterSize; // size of the <allInter> array
100 int *inter; // indexes into <allInter> for each y value
101 int interY; // current y value - used by getNextSpan
102 int interIdx; // current index into <inter> - used by
103 // getNextSpan
104 int interCount; // current EO/NZWN counter - used by
105 // getNextSpan
108 #endif