fix build with recent changes/gcc 6.3.0
[AROS-Contrib.git] / arospdf / splash / SplashClip.h
blob8ae2154bf6bac86be8e8b5d212a1853a862d2710
1 //========================================================================
2 //
3 // SplashClip.h
4 //
5 //========================================================================
7 #ifndef SPLASHCLIP_H
8 #define SPLASHCLIP_H
10 #include <aconf.h>
12 #ifdef USE_GCC_PRAGMAS
13 #pragma interface
14 #endif
16 #include "SplashTypes.h"
17 #include "SplashMath.h"
19 class SplashPath;
20 class SplashXPath;
21 class SplashXPathScanner;
22 class SplashBitmap;
24 //------------------------------------------------------------------------
26 enum SplashClipResult {
27 splashClipAllInside,
28 splashClipAllOutside,
29 splashClipPartial
32 //------------------------------------------------------------------------
33 // SplashClip
34 //------------------------------------------------------------------------
36 class SplashClip {
37 public:
39 // Create a clip, for the given rectangle.
40 SplashClip(SplashCoord x0, SplashCoord y0,
41 SplashCoord x1, SplashCoord y1,
42 GBool antialiasA);
44 // Copy a clip.
45 SplashClip *copy() { return new SplashClip(this); }
47 ~SplashClip();
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
67 // visible
68 // - splashClipAllOutside if the entire rectangle is outside the
69 // clipping region, i.e., all the pixels in the rectangle are
70 // clipped
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; }
93 private:
95 SplashClip(SplashClip *clip);
96 void grow(int nPaths);
98 GBool antialias;
99 SplashCoord xMin, yMin, xMax, yMax;
100 int xMinI, yMinI, xMaxI, yMaxI;
101 SplashXPath **paths;
102 Guchar *flags;
103 SplashXPathScanner **scanners;
104 int length, size;
107 #endif