source: trunk/poppler/mypoppler/splash/SplashClip.h @ 250

Last change on this file since 250 was 250, checked in by Eugene Romanenko, 13 years ago

PDF plugin: poppler library updated to version 0.8.3

File size: 2.9 KB
Line 
1//========================================================================
2//
3// SplashClip.h
4//
5//========================================================================
6
7#ifndef SPLASHCLIP_H
8#define SPLASHCLIP_H
9
10#ifdef USE_GCC_PRAGMAS
11#pragma interface
12#endif
13
14#include "SplashTypes.h"
15#include "SplashMath.h"
16
17class SplashPath;
18class SplashXPath;
19class SplashXPathScanner;
20class SplashBitmap;
21
22//------------------------------------------------------------------------
23
24enum SplashClipResult {
25  splashClipAllInside,
26  splashClipAllOutside,
27  splashClipPartial
28};
29
30//------------------------------------------------------------------------
31// SplashClip
32//------------------------------------------------------------------------
33
34class SplashClip {
35public:
36
37  // Create a clip, for the given rectangle.
38  SplashClip(SplashCoord x0, SplashCoord y0,
39             SplashCoord x1, SplashCoord y1,
40             GBool antialiasA);
41
42  // Copy a clip.
43  SplashClip *copy() { return new SplashClip(this); }
44
45  ~SplashClip();
46
47  // Reset the clip to a rectangle.
48  void resetToRect(SplashCoord x0, SplashCoord y0,
49                   SplashCoord x1, SplashCoord y1);
50
51  // Intersect the clip with a rectangle.
52  SplashError clipToRect(SplashCoord x0, SplashCoord y0,
53                         SplashCoord x1, SplashCoord y1);
54
55  // Interesect the clip with <path>.
56  SplashError clipToPath(SplashPath *path, SplashCoord *matrix,
57                         SplashCoord flatness, GBool eo);
58
59  // Returns true if (<x>,<y>) is inside the clip.
60  GBool test(int x, int y);
61
62  // Tests a rectangle against the clipping region.  Returns one of:
63  //   - splashClipAllInside if the entire rectangle is inside the
64  //     clipping region, i.e., all pixels in the rectangle are
65  //     visible
66  //   - splashClipAllOutside if the entire rectangle is outside the
67  //     clipping region, i.e., all the pixels in the rectangle are
68  //     clipped
69  //   - splashClipPartial if the rectangle is part inside and part
70  //     outside the clipping region
71  SplashClipResult testRect(int rectXMin, int rectYMin,
72                            int rectXMax, int rectYMax);
73
74  // Similar to testRect, but tests a horizontal span.
75  SplashClipResult testSpan(int spanXMin, int spanXMax, int spanY);
76
77  // Clips an anti-aliased line by setting pixels to zero.  On entry,
78  // all non-zero pixels are between <x0> and <x1>.  This function
79  // will update <x0> and <x1>.
80  void clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y);
81
82  // Get the rectangle part of the clip region, in integer coordinates.
83  int getXMinI() { return xMinI; }
84  int getXMaxI() { return xMaxI; }
85  int getYMinI() { return yMinI; }
86  int getYMaxI() { return yMaxI; }
87
88  // Get the number of arbitrary paths used by the clip region.
89  int getNumPaths() { return length; }
90
91private:
92
93  SplashClip(SplashClip *clip);
94  void grow(int nPaths);
95
96  GBool antialias;
97  SplashCoord xMin, yMin, xMax, yMax;
98  int xMinI, yMinI, xMaxI, yMaxI;
99  SplashXPath **paths;
100  Guchar *flags;
101  SplashXPathScanner **scanners;
102  int length, size;
103};
104
105#endif
Note: See TracBrowser for help on using the repository browser.