1 //========================================================================
5 //========================================================================
10 #pragma implementation
15 #include "SplashPattern.h"
16 #include "SplashScreen.h"
17 #include "SplashClip.h"
18 #include "SplashState.h"
20 //------------------------------------------------------------------------
22 //------------------------------------------------------------------------
24 // number of components in each color mode
25 int splashColorModeNComps
[] = {
29 SplashState::SplashState(int width
, int height
) {
32 memset(&color
, 0, sizeof(SplashColor
));
33 strokePattern
= new SplashSolidColor(color
);
34 fillPattern
= new SplashSolidColor(color
);
35 screen
= new SplashScreen(10);
40 lineCap
= splashLineCapButt
;
41 lineJoin
= splashLineJoinMiter
;
47 clip
= new SplashClip(0, 0, width
- 1, height
- 1);
51 SplashState::SplashState(SplashState
*state
) {
52 strokePattern
= state
->strokePattern
->copy();
53 fillPattern
= state
->fillPattern
->copy();
54 screen
= state
->screen
->copy();
55 blendFunc
= state
->blendFunc
;
56 strokeAlpha
= state
->strokeAlpha
;
57 fillAlpha
= state
->fillAlpha
;
58 lineWidth
= state
->lineWidth
;
59 lineCap
= state
->lineCap
;
60 lineJoin
= state
->lineJoin
;
61 miterLimit
= state
->miterLimit
;
62 flatness
= state
->flatness
;
63 if (state
->lineDash
) {
64 lineDashLength
= state
->lineDashLength
;
65 lineDash
= (SplashCoord
*)gmallocn(lineDashLength
, sizeof(SplashCoord
));
66 memcpy(lineDash
, state
->lineDash
, lineDashLength
* sizeof(SplashCoord
));
71 lineDashPhase
= state
->lineDashPhase
;
72 clip
= state
->clip
->copy();
76 SplashState::~SplashState() {
84 void SplashState::setStrokePattern(SplashPattern
*strokePatternA
) {
86 strokePattern
= strokePatternA
;
89 void SplashState::setFillPattern(SplashPattern
*fillPatternA
) {
91 fillPattern
= fillPatternA
;
94 void SplashState::setScreen(SplashScreen
*screenA
) {
99 void SplashState::setLineDash(SplashCoord
*lineDashA
, int lineDashLengthA
,
100 SplashCoord lineDashPhaseA
) {
102 lineDashLength
= lineDashLengthA
;
103 if (lineDashLength
> 0) {
104 lineDash
= (SplashCoord
*)gmallocn(lineDashLength
, sizeof(SplashCoord
));
105 memcpy(lineDash
, lineDashA
, lineDashLength
* sizeof(SplashCoord
));
109 lineDashPhase
= lineDashPhaseA
;