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