1
//========================================================================
5
//========================================================================
12
#ifdef USE_GCC_PRAGMAS
16
#include "SplashTypes.h"
17
#include "SplashMath.h"
21
class SplashXPathScanner;
24
//------------------------------------------------------------------------
26
enum SplashClipResult {
32
//------------------------------------------------------------------------
34
//------------------------------------------------------------------------
39
// Create a clip, for the given rectangle.
40
SplashClip(SplashCoord x0, SplashCoord y0,
41
SplashCoord x1, SplashCoord y1,
45
SplashClip *copy() { return new SplashClip(this); }
49
// Reset the clip to a rectangle.
50
void resetToRect(SplashCoord x0, SplashCoord y0,
51
SplashCoord x1, SplashCoord y1);
53
// Intersect the clip with a rectangle.
54
SplashError clipToRect(SplashCoord x0, SplashCoord y0,
55
SplashCoord x1, SplashCoord y1);
57
// Interesect the clip with <path>.
58
SplashError clipToPath(SplashPath *path, SplashCoord *matrix,
59
SplashCoord flatness, GBool eo);
61
// Returns true if (<x>,<y>) is inside the clip.
62
GBool test(int x, int y);
64
// Tests a rectangle against the clipping region. Returns one of:
65
// - splashClipAllInside if the entire rectangle is inside the
66
// clipping region, i.e., all pixels in the rectangle are
68
// - splashClipAllOutside if the entire rectangle is outside the
69
// clipping region, i.e., all the pixels in the rectangle are
71
// - splashClipPartial if the rectangle is part inside and part
72
// outside the clipping region
73
SplashClipResult testRect(int rectXMin, int rectYMin,
74
int rectXMax, int rectYMax);
76
// Similar to testRect, but tests a horizontal span.
77
SplashClipResult testSpan(int spanXMin, int spanXMax, int spanY);
79
// Clips an anti-aliased line by setting pixels to zero. On entry,
80
// all non-zero pixels are between <x0> and <x1>. This function
81
// will update <x0> and <x1>.
82
void clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y);
84
// Get the rectangle part of the clip region, in integer coordinates.
85
int getXMinI() { return xMinI; }
86
int getXMaxI() { return xMaxI; }
87
int getYMinI() { return yMinI; }
88
int getYMaxI() { return yMaxI; }
90
// Get the number of arbitrary paths used by the clip region.
91
int getNumPaths() { return length; }
95
SplashClip(SplashClip *clip);
96
void grow(int nPaths);
99
SplashCoord xMin, yMin, xMax, yMax;
100
int xMinI, yMinI, xMaxI, yMaxI;
103
SplashXPathScanner **scanners;