summaryrefslogtreecommitdiff
path: root/Build/source/libs/xpdf/xpdf-src/splash/SplashXPathScanner.h
blob: 39cc0eb022ad3e1b1c35604ff06dd5d4fdcfded1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//========================================================================
//
// SplashXPathScanner.h
//
// Copyright 2003-2013 Glyph & Cog, LLC
//
//========================================================================

#ifndef SPLASHXPATHSCANNER_H
#define SPLASHXPATHSCANNER_H

#include <aconf.h>

#ifdef USE_GCC_PRAGMAS
#pragma interface
#endif

#include "SplashTypes.h"
#include "SplashXPath.h"

class GList;

//------------------------------------------------------------------------

// Set this to 0 for antialiasing with 16 levels of gray.
// Set it to 1 for (much slower) antialiasing with 256 levels of gray.
#define ANTIALIAS_256 0

//------------------------------------------------------------------------
// SplashXPathScanner
//------------------------------------------------------------------------

class SplashXPathScanner {
public:

  // Create a new SplashXPathScanner object.  <xPathA> must be sorted.
  SplashXPathScanner(SplashXPath *xPathA, GBool eo,
		     int yMinA, int yMaxA);

  ~SplashXPathScanner();

  // Compute shape values for a scan line.  Fills in line[] with shape
  // values for one scan line: ([x0, x1], y).  The values are in [0,
  // 255].  Also returns the min/max x positions with non-zero shape
  // values.
  void getSpan(Guchar *line, int y, int x0, int x1, int *xMin, int *xMax);

  // Like getSpan(), but uses the values 0 and 255 only.  Writes 255
  // for all pixels which include non-zero area inside the path.
  void getSpanBinary(Guchar *line, int y, int x0, int x1,
		     int *xMin, int *xMax);

private:

  void insertSegmentBefore(SplashXPathSeg *s, SplashXPathSeg *sNext);
  void removeSegment(SplashXPathSeg *s);
  void moveSegmentAfter(SplashXPathSeg *s, SplashXPathSeg *sPrev);
  void reset(GBool aa, GBool aaChanged);
  void skip(int newYBottomI, GBool aa);
  void advance(GBool aa);
  void generatePixels(int x0, int x1, Guchar *line, int *xMin, int *xMax);
  void generatePixelsBinary(int x0, int x1, Guchar *line,
			    int *xMin, int *xMax);
  void drawRectangleSpan(Guchar *line, int y, int x0, int x1,
			 int *xMin, int *xMax);
  void drawRectangleSpanBinary(Guchar *line, int y, int x0, int x1,
			       int *xMin, int *xMax);

  SplashXPath *xPath;
  int eoMask;
  int yMin, yMax;
  int rectX0I, rectY0I, rectX1I, rectY1I;

  SplashXPathSeg preSeg, postSeg;
  SplashXPathSeg *pre, *post;

  GBool resetDone;
  GBool resetAA;
  int nextSeg;
  int yTopI, yBottomI;
  SplashCoord yTop, yBottom;
};

#endif