1 //========================================================================
2 //
3 // SplashState.h
4 //
5 // Copyright 2003-2013 Glyph & Cog, LLC
6 //
7 //========================================================================
8 
9 #ifndef SPLASHSTATE_H
10 #define SPLASHSTATE_H
11 
12 #include <aconf.h>
13 
14 #ifdef USE_GCC_PRAGMAS
15 #pragma interface
16 #endif
17 
18 #include "SplashTypes.h"
19 
20 class SplashPattern;
21 class SplashScreen;
22 class SplashClip;
23 class SplashBitmap;
24 class SplashPath;
25 
26 //------------------------------------------------------------------------
27 // line cap values
28 //------------------------------------------------------------------------
29 
30 #define splashLineCapButt       0
31 #define splashLineCapRound      1
32 #define splashLineCapProjecting 2
33 
34 //------------------------------------------------------------------------
35 // line join values
36 //------------------------------------------------------------------------
37 
38 #define splashLineJoinMiter     0
39 #define splashLineJoinRound     1
40 #define splashLineJoinBevel     2
41 
42 //------------------------------------------------------------------------
43 // SplashState
44 //------------------------------------------------------------------------
45 
46 class SplashState {
47 public:
48 
49   // Create a new state object, initialized with default settings.
50   SplashState(int width, int height, GBool vectorAntialias,
51 	      SplashScreenParams *screenParams);
52   SplashState(int width, int height, GBool vectorAntialias,
53 	      SplashScreen *screenA);
54 
55   // Copy a state object.
copy()56   SplashState *copy() { return new SplashState(this); }
57 
58   ~SplashState();
59 
60   // Set the stroke pattern.  This does not copy <strokePatternA>.
61   void setStrokePattern(SplashPattern *strokePatternA);
62 
63   // Set the fill pattern.  This does not copy <fillPatternA>.
64   void setFillPattern(SplashPattern *fillPatternA);
65 
66   // Set the screen.  This does not copy <screenA>.
67   void setScreen(SplashScreen *screenA);
68 
69   // Set the line dash pattern.  This copies the <lineDashA> array.
70   void setLineDash(SplashCoord *lineDashA, int lineDashLengthA,
71 		   SplashCoord lineDashPhaseA);
72 
73   void clipResetToRect(SplashCoord x0, SplashCoord y0,
74 		       SplashCoord x1, SplashCoord y1);
75   SplashError clipToRect(SplashCoord x0, SplashCoord y0,
76 			 SplashCoord x1, SplashCoord y1);
77   SplashError clipToPath(SplashPath *path, GBool eo);
78 
79   // Set the soft mask bitmap.
80   void setSoftMask(SplashBitmap *softMaskA);
81 
82   // Set the transfer function.
83   void setTransfer(Guchar *red, Guchar *green, Guchar *blue, Guchar *gray);
84 
85 private:
86 
87   SplashState(SplashState *state);
88 
89   SplashCoord matrix[6];
90   SplashPattern *strokePattern;
91   SplashPattern *fillPattern;
92   SplashScreen *screen;
93   SplashBlendFunc blendFunc;
94   SplashCoord strokeAlpha;
95   SplashCoord fillAlpha;
96   SplashCoord lineWidth;
97   int lineCap;
98   int lineJoin;
99   SplashCoord miterLimit;
100   SplashCoord flatness;
101   SplashCoord *lineDash;
102   int lineDashLength;
103   SplashCoord lineDashPhase;
104   GBool strokeAdjust;
105   SplashClip *clip;
106   GBool clipIsShared;
107   SplashBitmap *softMask;
108   GBool deleteSoftMask;
109   GBool inNonIsolatedGroup;
110   GBool inKnockoutGroup;
111   Guchar rgbTransferR[256],
112          rgbTransferG[256],
113          rgbTransferB[256];
114   Guchar grayTransfer[256];
115   Guchar cmykTransferC[256],
116          cmykTransferM[256],
117          cmykTransferY[256],
118          cmykTransferK[256];
119   Guint overprintMask;
120 
121   SplashState *next;		// used by Splash class
122 
123   friend class Splash;
124 };
125 
126 #endif
127