| 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 |
#include "SplashTypes.h" |
| 15 |
|
| 16 |
class SplashPattern; |
| 17 |
class SplashScreen; |
| 18 |
class SplashClip; |
| 19 |
class SplashBitmap; |
| 20 |
class SplashPath; |
| 21 |
|
| 22 |
//------------------------------------------------------------------------ |
| 23 |
// line cap values |
| 24 |
//------------------------------------------------------------------------ |
| 25 |
|
| 26 |
#define splashLineCapButt 0 |
| 27 |
#define splashLineCapRound 1 |
| 28 |
#define splashLineCapProjecting 2 |
| 29 |
|
| 30 |
//------------------------------------------------------------------------ |
| 31 |
// line join values |
| 32 |
//------------------------------------------------------------------------ |
| 33 |
|
| 34 |
#define splashLineJoinMiter 0 |
| 35 |
#define splashLineJoinRound 1 |
| 36 |
#define splashLineJoinBevel 2 |
| 37 |
|
| 38 |
//------------------------------------------------------------------------ |
| 39 |
// SplashState |
| 40 |
//------------------------------------------------------------------------ |
| 41 |
|
| 42 |
class SplashState { |
| 43 |
public: |
| 44 |
|
| 45 |
// Create a new state object, initialized with default settings. |
| 46 |
SplashState(int width, int height, GBool vectorAntialias, |
| 47 |
SplashScreenParams *screenParams); |
| 48 |
SplashState(int width, int height, GBool vectorAntialias, |
| 49 |
SplashScreen *screenA); |
| 50 |
|
| 51 |
// Copy a state object. |
| 52 |
SplashState *copy() { return new SplashState(this); } |
| 53 |
|
| 54 |
~SplashState(); |
| 55 |
|
| 56 |
// Set the stroke pattern. This does not copy <strokePatternA>. |
| 57 |
void setStrokePattern(SplashPattern *strokePatternA); |
| 58 |
|
| 59 |
// Set the fill pattern. This does not copy <fillPatternA>. |
| 60 |
void setFillPattern(SplashPattern *fillPatternA); |
| 61 |
|
| 62 |
// Set the screen. This does not copy <screenA>. |
| 63 |
void setScreen(SplashScreen *screenA); |
| 64 |
|
| 65 |
// Set the line dash pattern. This copies the <lineDashA> array. |
| 66 |
void setLineDash(SplashCoord *lineDashA, int lineDashLengthA, |
| 67 |
SplashCoord lineDashPhaseA); |
| 68 |
|
| 69 |
// Returns true if the current line dash pattern contains one or |
| 70 |
// more zero-length "on" sections (dashes). |
| 71 |
GBool lineDashContainsZeroLengthDashes(); |
| 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, GBool deleteBitmap = gTrue); |
| 81 |
|
| 82 |
// Set the transfer function. |
| 83 |
void setTransfer(Guchar *red, Guchar *green, Guchar *blue, Guchar *gray); |
| 84 |
|
| 85 |
|
| 86 |
private: |
| 87 |
|
| 88 |
SplashState(SplashState *state); |
| 89 |
|
| 90 |
SplashCoord matrix[6]; |
| 91 |
SplashPattern *strokePattern; |
| 92 |
SplashPattern *fillPattern; |
| 93 |
SplashScreen *screen; |
| 94 |
SplashBlendFunc blendFunc; |
| 95 |
SplashCoord strokeAlpha; |
| 96 |
SplashCoord fillAlpha; |
| 97 |
SplashCoord lineWidth; |
| 98 |
int lineCap; |
| 99 |
int lineJoin; |
| 100 |
SplashCoord miterLimit; |
| 101 |
SplashCoord flatness; |
| 102 |
SplashCoord *lineDash; |
| 103 |
int lineDashLength; |
| 104 |
SplashCoord lineDashPhase; |
| 105 |
SplashStrokeAdjustMode strokeAdjust; |
| 106 |
GBool alphaIsShape; |
| 107 |
SplashClip *clip; |
| 108 |
GBool clipIsShared; |
| 109 |
SplashBitmap *softMask; |
| 110 |
GBool deleteSoftMask; |
| 111 |
GBool inNonIsolatedGroup; |
| 112 |
GBool inKnockoutGroup; |
| 113 |
Guchar *rgbTransferR; |
| 114 |
Guchar *rgbTransferG; |
| 115 |
Guchar *rgbTransferB; |
| 116 |
Guchar *grayTransfer; |
| 117 |
#if SPLASH_CMYK |
| 118 |
Guchar *cmykTransferC; |
| 119 |
Guchar *cmykTransferM; |
| 120 |
Guchar *cmykTransferY; |
| 121 |
Guchar *cmykTransferK; |
| 122 |
#endif |
| 123 |
GBool transferIsShared; |
| 124 |
Guint overprintMask; |
| 125 |
GBool enablePathSimplification; |
| 126 |
|
| 127 |
|
| 128 |
SplashState *next; // used by Splash class |
| 129 |
|
| 130 |
friend class Splash; |
| 131 |
}; |
| 132 |
|
| 133 |
#endif |