1
//========================================================================
5
//========================================================================
10
#pragma implementation
15
#include "splash/SplashPattern.h"
16
#include "splash/SplashScreen.h"
17
#include "splash/SplashBitmap.h"
18
#include "splash/SplashState.h"
19
#include "OPVPSplashState.h"
20
#include "OPVPSplashClip.h"
22
//------------------------------------------------------------------------
24
//------------------------------------------------------------------------
26
// number of components in each color mode
27
static int opvpSplashColorModeNComps[] = {
31
OPVPSplashState::OPVPSplashState(int width, int height, GBool vectorAntialias,
32
SplashScreenParams *screenParams) {
35
matrix[0] = 1; matrix[1] = 0;
36
matrix[2] = 0; matrix[3] = 1;
37
matrix[4] = 0; matrix[5] = 0;
38
memset(&color, 0, sizeof(SplashColor));
39
strokePattern = new SplashSolidColor(color);
40
fillPattern = new SplashSolidColor(color);
41
screen = new SplashScreen(screenParams);
46
lineCap = splashLineCapButt;
47
lineJoin = splashLineJoinMiter;
53
strokeAdjust = gFalse;
54
clip = new OPVPSplashClip(0, 0, width - 0.001,
55
height - 0.001, vectorAntialias);
57
deleteSoftMask = gFalse;
58
inNonIsolatedGroup = gFalse;
62
OPVPSplashState::OPVPSplashState(int width, int height, GBool vectorAntialias,
63
SplashScreen *screenA) {
66
matrix[0] = 1; matrix[1] = 0;
67
matrix[2] = 0; matrix[3] = 1;
68
matrix[4] = 0; matrix[5] = 0;
69
memset(&color, 0, sizeof(SplashColor));
70
strokePattern = new SplashSolidColor(color);
71
fillPattern = new SplashSolidColor(color);
72
screen = screenA->copy();
77
lineCap = splashLineCapButt;
78
lineJoin = splashLineJoinMiter;
84
strokeAdjust = gFalse;
85
clip = new OPVPSplashClip(0, 0, width - 0.001,
86
height - 0.001, vectorAntialias);
88
deleteSoftMask = gFalse;
89
inNonIsolatedGroup = gFalse;
93
OPVPSplashState::OPVPSplashState(OPVPSplashState *state) {
94
memcpy(matrix, state->matrix, 6 * sizeof(SplashCoord));
95
strokePattern = state->strokePattern->copy();
96
fillPattern = state->fillPattern->copy();
97
screen = state->screen->copy();
98
blendFunc = state->blendFunc;
99
strokeAlpha = state->strokeAlpha;
100
fillAlpha = state->fillAlpha;
101
lineWidth = state->lineWidth;
102
lineCap = state->lineCap;
103
lineJoin = state->lineJoin;
104
miterLimit = state->miterLimit;
105
flatness = state->flatness;
106
if (state->lineDash) {
107
lineDashLength = state->lineDashLength;
108
lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord));
109
memcpy(lineDash, state->lineDash, lineDashLength * sizeof(SplashCoord));
114
lineDashPhase = state->lineDashPhase;
115
strokeAdjust = state->strokeAdjust;
116
clip = state->clip->copy();
117
softMask = state->softMask;
118
deleteSoftMask = gFalse;
119
inNonIsolatedGroup = state->inNonIsolatedGroup;
123
OPVPSplashState::~OPVPSplashState() {
124
delete strokePattern;
129
if (deleteSoftMask && softMask) {
134
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
135
void OPVPSplashState::setState(Splash *osplash) {
136
osplash->setMatrix(matrix);
137
osplash->setFlatness(flatness);
138
osplash->setLineDash(lineDash,lineDashLength,lineDashPhase);
139
osplash->setLineCap(lineCap);
140
osplash->setStrokeAdjust(strokeAdjust);
141
osplash->setMiterLimit(miterLimit);
142
osplash->setLineJoin(lineJoin);
146
void OPVPSplashState::setStrokePattern(SplashPattern *strokePatternA) {
147
delete strokePattern;
148
strokePattern = strokePatternA;
151
void OPVPSplashState::setFillPattern(SplashPattern *fillPatternA) {
153
fillPattern = fillPatternA;
156
void OPVPSplashState::setScreen(SplashScreen *screenA) {
161
void OPVPSplashState::setLineDash(SplashCoord *lineDashA, int lineDashLengthA,
162
SplashCoord lineDashPhaseA) {
164
lineDashLength = lineDashLengthA;
165
if (lineDashLength > 0) {
166
lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord));
167
memcpy(lineDash, lineDashA, lineDashLength * sizeof(SplashCoord));
171
lineDashPhase = lineDashPhaseA;
174
void OPVPSplashState::setSoftMask(SplashBitmap *softMaskA) {
175
if (deleteSoftMask) {
178
softMask = softMaskA;
179
deleteSoftMask = gTrue;