1 //========================================================================
5 //========================================================================
10 #pragma implementation
15 #include "SplashPattern.h"
16 #include "SplashScreen.h"
17 #include "SplashClip.h"
18 #include "SplashState.h"
20 //------------------------------------------------------------------------
22 //------------------------------------------------------------------------
24 SplashState::SplashState(int width, int height) {
27 memset(&color, 0, sizeof(SplashColor));
28 strokePattern = new SplashSolidColor(color);
29 fillPattern = new SplashSolidColor(color);
30 screen = new SplashScreen(10);
32 lineCap = splashLineCapButt;
33 lineJoin = splashLineJoinMiter;
39 clip = new SplashClip(0, 0, width - 1, height - 1);
43 SplashState::SplashState(SplashState *state) {
44 strokePattern = state->strokePattern->copy();
45 fillPattern = state->fillPattern->copy();
46 screen = state->screen->copy();
47 lineWidth = state->lineWidth;
48 lineCap = state->lineCap;
49 lineJoin = state->lineJoin;
50 miterLimit = state->miterLimit;
51 flatness = state->flatness;
52 if (state->lineDash) {
53 lineDashLength = state->lineDashLength;
54 lineDash = (SplashCoord *)gmalloc(lineDashLength * sizeof(SplashCoord));
55 memcpy(lineDash, state->lineDash, lineDashLength * sizeof(SplashCoord));
60 lineDashPhase = state->lineDashPhase;
61 clip = state->clip->copy();
65 SplashState::~SplashState() {
73 void SplashState::setStrokePattern(SplashPattern *strokePatternA) {
75 strokePattern = strokePatternA;
78 void SplashState::setFillPattern(SplashPattern *fillPatternA) {
80 fillPattern = fillPatternA;
83 void SplashState::setScreen(SplashScreen *screenA) {
88 void SplashState::setLineDash(SplashCoord *lineDashA, int lineDashLengthA,
89 SplashCoord lineDashPhaseA) {
91 lineDashLength = lineDashLengthA;
92 if (lineDashLength > 0) {
93 lineDash = (SplashCoord *)gmalloc(lineDashLength * sizeof(SplashCoord));
94 memcpy(lineDash, lineDashA, lineDashLength * sizeof(SplashCoord));
98 lineDashPhase = lineDashPhaseA;