1 //========================================================================
3 // SplashXPathScanner.h
5 //========================================================================
7 //========================================================================
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
28 #include "SplashTypes.h"
32 struct SplashIntersect
;
34 //------------------------------------------------------------------------
36 //------------------------------------------------------------------------
38 class SplashXPathScanner
{
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
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
);
87 void computeIntersections();
88 GBool
addIntersection(double segYMin
, double segYMax
,
90 int y
, int x0
, int x1
);
94 int xMin
, yMin
, xMax
, yMax
;
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
104 int interCount
; // current EO/NZWN counter - used by