1
//========================================================================
5
//========================================================================
7
//========================================================================
9
// Modified under the Poppler project - http://poppler.freedesktop.org
11
// All changes made under the Poppler project to this file are licensed
12
// under GPL version 2 or later
14
// Copyright (C) 2009 Thomas Freitag <Thomas.Freitag@alfa.de>
16
// To see a description of the changes please see the Changelog file that
17
// came with your tarball or type make ChangeLog if you are building from git
19
//========================================================================
23
#ifdef USE_GCC_PRAGMAS
24
#pragma implementation
29
#include "SplashPattern.h"
30
#include "SplashScreen.h"
31
#include "SplashClip.h"
32
#include "SplashBitmap.h"
33
#include "SplashState.h"
35
//------------------------------------------------------------------------
37
//------------------------------------------------------------------------
39
// number of components in each color mode
40
int splashColorModeNComps[] = {
47
SplashState::SplashState(int width, int height, GBool vectorAntialias,
48
SplashScreenParams *screenParams) {
51
matrix[0] = 1; matrix[1] = 0;
52
matrix[2] = 0; matrix[3] = 1;
53
matrix[4] = 0; matrix[5] = 0;
54
memset(&color, 0, sizeof(SplashColor));
55
strokePattern = new SplashSolidColor(color);
56
fillPattern = new SplashSolidColor(color);
57
screen = new SplashScreen(screenParams);
62
lineCap = splashLineCapButt;
63
lineJoin = splashLineJoinMiter;
69
strokeAdjust = gFalse;
70
clip = new SplashClip(0, 0, width - 0.001, height - 0.001, vectorAntialias);
72
deleteSoftMask = gFalse;
73
inNonIsolatedGroup = gFalse;
77
SplashState::SplashState(int width, int height, GBool vectorAntialias,
78
SplashScreen *screenA) {
81
matrix[0] = 1; matrix[1] = 0;
82
matrix[2] = 0; matrix[3] = 1;
83
matrix[4] = 0; matrix[5] = 0;
84
memset(&color, 0, sizeof(SplashColor));
85
strokePattern = new SplashSolidColor(color);
86
fillPattern = new SplashSolidColor(color);
87
screen = screenA->copy();
92
lineCap = splashLineCapButt;
93
lineJoin = splashLineJoinMiter;
99
strokeAdjust = gFalse;
100
clip = new SplashClip(0, 0, width - 0.001, height - 0.001, vectorAntialias);
102
deleteSoftMask = gFalse;
103
inNonIsolatedGroup = gFalse;
107
SplashState::SplashState(SplashState *state) {
108
memcpy(matrix, state->matrix, 6 * sizeof(SplashCoord));
109
strokePattern = state->strokePattern->copy();
110
fillPattern = state->fillPattern->copy();
111
screen = state->screen->copy();
112
blendFunc = state->blendFunc;
113
strokeAlpha = state->strokeAlpha;
114
fillAlpha = state->fillAlpha;
115
lineWidth = state->lineWidth;
116
lineCap = state->lineCap;
117
lineJoin = state->lineJoin;
118
miterLimit = state->miterLimit;
119
flatness = state->flatness;
120
if (state->lineDash) {
121
lineDashLength = state->lineDashLength;
122
lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord));
123
memcpy(lineDash, state->lineDash, lineDashLength * sizeof(SplashCoord));
128
lineDashPhase = state->lineDashPhase;
129
strokeAdjust = state->strokeAdjust;
130
clip = state->clip->copy();
131
softMask = state->softMask;
132
deleteSoftMask = gFalse;
133
inNonIsolatedGroup = state->inNonIsolatedGroup;
137
SplashState::~SplashState() {
138
delete strokePattern;
143
if (deleteSoftMask && softMask) {
148
void SplashState::setStrokePattern(SplashPattern *strokePatternA) {
149
delete strokePattern;
150
strokePattern = strokePatternA;
153
void SplashState::setFillPattern(SplashPattern *fillPatternA) {
155
fillPattern = fillPatternA;
158
void SplashState::setScreen(SplashScreen *screenA) {
163
void SplashState::setLineDash(SplashCoord *lineDashA, int lineDashLengthA,
164
SplashCoord lineDashPhaseA) {
166
lineDashLength = lineDashLengthA;
167
if (lineDashLength > 0) {
168
lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord));
169
memcpy(lineDash, lineDashA, lineDashLength * sizeof(SplashCoord));
173
lineDashPhase = lineDashPhaseA;
176
void SplashState::setSoftMask(SplashBitmap *softMaskA) {
177
if (deleteSoftMask) {
180
softMask = softMaskA;
181
deleteSoftMask = gTrue;