| 1 |
//======================================================================== |
| 2 |
// |
| 3 |
// SplashXPathScanner.h |
| 4 |
// |
| 5 |
// Copyright 2003-2013 Glyph & Cog, LLC |
| 6 |
// |
| 7 |
//======================================================================== |
| 8 |
|
| 9 |
#ifndef SPLASHXPATHSCANNER_H |
| 10 |
#define SPLASHXPATHSCANNER_H |
| 11 |
|
| 12 |
#include <aconf.h> |
| 13 |
|
| 14 |
#include "SplashTypes.h" |
| 15 |
#include "SplashXPath.h" |
| 16 |
|
| 17 |
class GList; |
| 18 |
|
| 19 |
//------------------------------------------------------------------------ |
| 20 |
|
| 21 |
// Set this to 0 for antialiasing with 16 levels of gray. |
| 22 |
// Set it to 1 for (much slower) antialiasing with 256 levels of gray. |
| 23 |
#define ANTIALIAS_256 0 |
| 24 |
|
| 25 |
//------------------------------------------------------------------------ |
| 26 |
// SplashXPathScanner |
| 27 |
//------------------------------------------------------------------------ |
| 28 |
|
| 29 |
class SplashXPathScanner { |
| 30 |
public: |
| 31 |
|
| 32 |
// Create a new SplashXPathScanner object. <xPathA> must be sorted. |
| 33 |
SplashXPathScanner(SplashXPath *xPathA, GBool eo, |
| 34 |
int yMinA, int yMaxA); |
| 35 |
|
| 36 |
~SplashXPathScanner(); |
| 37 |
|
| 38 |
// Compute shape values for a scan line. Fills in line[] with shape |
| 39 |
// values for one scan line: ([x0, x1], y). The values are in [0, |
| 40 |
// 255]. Also returns the min/max x positions with non-zero shape |
| 41 |
// values. |
| 42 |
void getSpan(Guchar *line, int y, int x0, int x1, int *xMin, int *xMax); |
| 43 |
|
| 44 |
// Like getSpan(), but uses the values 0 and 255 only. Writes 255 |
| 45 |
// for all pixels which include non-zero area inside the path. |
| 46 |
void getSpanBinary(Guchar *line, int y, int x0, int x1, |
| 47 |
int *xMin, int *xMax); |
| 48 |
|
| 49 |
private: |
| 50 |
|
| 51 |
void insertSegmentBefore(SplashXPathSeg *s, SplashXPathSeg *sNext); |
| 52 |
void removeSegment(SplashXPathSeg *s); |
| 53 |
void moveSegmentAfter(SplashXPathSeg *s, SplashXPathSeg *sPrev); |
| 54 |
void reset(GBool aa, GBool aaChanged); |
| 55 |
void skip(int newYBottomI, GBool aa); |
| 56 |
void advance(GBool aa); |
| 57 |
void generatePixels(int x0, int x1, Guchar *line, int *xMin, int *xMax); |
| 58 |
void generatePixelsBinary(int x0, int x1, Guchar *line, |
| 59 |
int *xMin, int *xMax); |
| 60 |
void drawRectangleSpan(Guchar *line, int y, int x0, int x1, |
| 61 |
int *xMin, int *xMax); |
| 62 |
void drawRectangleSpanBinary(Guchar *line, int y, int x0, int x1, |
| 63 |
int *xMin, int *xMax); |
| 64 |
|
| 65 |
SplashXPath *xPath; |
| 66 |
int eoMask; |
| 67 |
int yMin, yMax; |
| 68 |
int rectX0I, rectY0I, rectX1I, rectY1I; |
| 69 |
|
| 70 |
SplashXPathSeg preSeg, postSeg; |
| 71 |
SplashXPathSeg *pre, *post; |
| 72 |
|
| 73 |
GBool resetDone; |
| 74 |
GBool resetAA; |
| 75 |
int nextSeg; |
| 76 |
int yTopI, yBottomI; |
| 77 |
SplashCoord yTop, yBottom; |
| 78 |
}; |
| 79 |
|
| 80 |
#endif |