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

Last change on this file since 44 was 2, checked in by Eugene Romanenko, 16 years ago

First import

File size: 2.5 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
16class SplashPath;
17class SplashXPath;
18class SplashXPathScanner;
19
20//------------------------------------------------------------------------
21
22enum SplashClipResult {
23  splashClipAllInside,
24  splashClipAllOutside,
25  splashClipPartial
26};
27
28//------------------------------------------------------------------------
29// SplashClip
30//------------------------------------------------------------------------
31
32class SplashClip {
33public:
34
35  // Create a clip, for the given rectangle.
36  SplashClip(SplashCoord x0, SplashCoord y0,
37             SplashCoord x1, SplashCoord y1);
38
39  // Copy a clip.
40  SplashClip *copy() { return new SplashClip(this); }
41
42  ~SplashClip();
43
44  // Reset the clip to a rectangle.
45  void resetToRect(SplashCoord x0, SplashCoord y0,
46                   SplashCoord x1, SplashCoord y1);
47
48  // Intersect the clip with a rectangle.
49  SplashError clipToRect(SplashCoord x0, SplashCoord y0,
50                         SplashCoord x1, SplashCoord y1);
51
52  // Interesect the clip with <path>.
53  SplashError clipToPath(SplashPath *path, SplashCoord flatness,
54                         GBool eo);
55
56  // Returns true if (<x>,<y>) is inside the clip.
57  GBool test(int x, int y);
58
59  // Tests a rectangle against the clipping region.  Returns one of:
60  //   - splashClipAllInside if the entire rectangle is inside the
61  //     clipping region, i.e., all pixels in the rectangle are
62  //     visible
63  //   - splashClipAllOutside if the entire rectangle is outside the
64  //     clipping region, i.e., all the pixels in the rectangle are
65  //     clipped
66  //   - splashClipPartial if the rectangle is part inside and part
67  //     outside the clipping region
68  SplashClipResult testRect(int rectXMin, int rectYMin,
69                            int rectXMax, int rectYMax);
70
71  // Similar to testRect, but tests a horizontal span.
72  SplashClipResult testSpan(int spanXMin, int spanXMax, int spanY);
73
74  // Get the rectangle part of the clip region.
75  int getXMin() { return xMin; }
76  int getXMax() { return xMax; }
77  int getYMin() { return yMin; }
78  int getYMax() { return yMax; }
79
80  // Get the number of arbitrary paths used by the clip region.
81  int getNumPaths() { return length; }
82
83private:
84
85  SplashClip(SplashClip *clip);
86  void grow(int nPaths);
87
88  int xMin, yMin, xMax, yMax;
89  SplashXPath **paths;
90  Guchar *flags;
91  SplashXPathScanner **scanners;
92  int length, size;
93};
94
95#endif
Note: See TracBrowser for help on using the repository browser.