1
//========================================================================
5
//========================================================================
10
#pragma implementation
14
#ifdef HAVE_CPP_POPPLER_VERSION_H
15
#include "cpp/poppler-version.h"
18
#include "splash/SplashPattern.h"
19
#include "splash/SplashScreen.h"
20
#include "splash/SplashBitmap.h"
21
#include "splash/SplashState.h"
22
#include "OPVPSplashState.h"
23
#include "OPVPSplashClip.h"
25
//------------------------------------------------------------------------
27
//------------------------------------------------------------------------
29
// number of components in each color mode
30
static int opvpSplashColorModeNComps[] = {
34
OPVPSplashState::OPVPSplashState(int width, int height, GBool vectorAntialias,
35
SplashScreenParams *screenParams) {
38
matrix[0] = 1; matrix[1] = 0;
39
matrix[2] = 0; matrix[3] = 1;
40
matrix[4] = 0; matrix[5] = 0;
41
memset(&color, 0, sizeof(SplashColor));
42
strokePattern = new SplashSolidColor(color);
43
fillPattern = new SplashSolidColor(color);
44
screen = new SplashScreen(screenParams);
49
lineCap = splashLineCapButt;
50
lineJoin = splashLineJoinMiter;
56
strokeAdjust = gFalse;
57
clip = new OPVPSplashClip(0, 0, width - 0.001,
58
height - 0.001, vectorAntialias);
60
deleteSoftMask = gFalse;
61
inNonIsolatedGroup = gFalse;
65
OPVPSplashState::OPVPSplashState(int width, int height, GBool vectorAntialias,
66
SplashScreen *screenA) {
69
matrix[0] = 1; matrix[1] = 0;
70
matrix[2] = 0; matrix[3] = 1;
71
matrix[4] = 0; matrix[5] = 0;
72
memset(&color, 0, sizeof(SplashColor));
73
strokePattern = new SplashSolidColor(color);
74
fillPattern = new SplashSolidColor(color);
75
screen = screenA->copy();
80
lineCap = splashLineCapButt;
81
lineJoin = splashLineJoinMiter;
87
strokeAdjust = gFalse;
88
clip = new OPVPSplashClip(0, 0, width - 0.001,
89
height - 0.001, vectorAntialias);
91
deleteSoftMask = gFalse;
92
inNonIsolatedGroup = gFalse;
96
OPVPSplashState::OPVPSplashState(OPVPSplashState *state) {
97
memcpy(matrix, state->matrix, 6 * sizeof(SplashCoord));
98
strokePattern = state->strokePattern->copy();
99
fillPattern = state->fillPattern->copy();
100
screen = state->screen->copy();
101
blendFunc = state->blendFunc;
102
strokeAlpha = state->strokeAlpha;
103
fillAlpha = state->fillAlpha;
104
lineWidth = state->lineWidth;
105
lineCap = state->lineCap;
106
lineJoin = state->lineJoin;
107
miterLimit = state->miterLimit;
108
flatness = state->flatness;
109
if (state->lineDash) {
110
lineDashLength = state->lineDashLength;
111
lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord));
112
memcpy(lineDash, state->lineDash, lineDashLength * sizeof(SplashCoord));
117
lineDashPhase = state->lineDashPhase;
118
strokeAdjust = state->strokeAdjust;
119
clip = state->clip->copy();
120
softMask = state->softMask;
121
deleteSoftMask = gFalse;
122
inNonIsolatedGroup = state->inNonIsolatedGroup;
126
OPVPSplashState::~OPVPSplashState() {
127
delete strokePattern;
132
if (deleteSoftMask && softMask) {
137
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
138
void OPVPSplashState::setState(Splash *osplash) {
139
osplash->setMatrix(matrix);
140
osplash->setFlatness(flatness);
141
osplash->setLineDash(lineDash,lineDashLength,lineDashPhase);
142
osplash->setLineCap(lineCap);
143
osplash->setStrokeAdjust(strokeAdjust);
144
osplash->setMiterLimit(miterLimit);
145
osplash->setLineJoin(lineJoin);
149
void OPVPSplashState::setStrokePattern(SplashPattern *strokePatternA) {
150
delete strokePattern;
151
strokePattern = strokePatternA;
154
void OPVPSplashState::setFillPattern(SplashPattern *fillPatternA) {
156
fillPattern = fillPatternA;
159
void OPVPSplashState::setScreen(SplashScreen *screenA) {
164
void OPVPSplashState::setLineDash(SplashCoord *lineDashA, int lineDashLengthA,
165
SplashCoord lineDashPhaseA) {
167
lineDashLength = lineDashLengthA;
168
if (lineDashLength > 0) {
169
lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord));
170
memcpy(lineDash, lineDashA, lineDashLength * sizeof(SplashCoord));
174
lineDashPhase = lineDashPhaseA;
177
void OPVPSplashState::setSoftMask(SplashBitmap *softMaskA) {
178
if (deleteSoftMask) {
181
softMask = softMaskA;
182
deleteSoftMask = gTrue;