1
//========================================================================
5
//========================================================================
12
#ifdef USE_GCC_PRAGMAS
17
#include "splash/SplashTypes.h"
18
#include "splash/SplashPattern.h"
19
#include "splash/SplashErrorCodes.h"
20
#include "OPVPSplashPath.h"
21
#include "OPVPWrapper.h"
22
#include "CharTypes.h"
24
/* extra error code */
25
#define splashErrOPVP 100
27
#define OPVP_MAX_CLIPPATH_LENGTH 2000
28
#define OPVP_MAX_FILLPATH_LENGTH 4000
29
#define OPVP_BITMAPCHAR_THRESHOLD 2000
30
#define OPVP_ROP_SRCCOPY 0xCC
31
#define OPVP_ROP_S 0xCC
32
#define OPVP_ROP_P 0xF0
33
#define OPVP_ROP_PSDPxax 0xB8
34
#define OPVP_ROP_DSPDxax 0xE2
37
class SplashGlyphBitmap;
38
class OPVPSplashState;
42
class OPVPSplashXPath;
48
OPVPClipPath(OPVPSplashPath *pathA, GBool eoA);
50
static OPVPClipPath *pop();
51
~OPVPClipPath() { delete path; }
52
OPVPSplashPath *getPath() { return path; }
53
GBool getEo() { return eo; }
54
GBool getSaved() { return saved; }
61
static OPVPClipPath *stackTop;
64
//------------------------------------------------------------------------
66
//------------------------------------------------------------------------
71
// Create a new rasterizer object.
72
OPVPSplash(OPVPWrapper *opvpA,
73
int nOptions, const char *optionKeys[], const char *optionVals[]);
75
virtual ~OPVPSplash();
79
SplashPattern *getStrokePattern();
80
SplashPattern *getFillPattern();
81
SplashScreen *getScreen();
82
SplashCoord getLineWidth();
85
SplashCoord getMiterLimit();
86
SplashCoord getFlatness();
87
SplashCoord *getLineDash();
88
int getLineDashLength();
89
SplashCoord getLineDashPhase();
90
OPVPSplashClip *getClip();
94
void setStrokePattern(SplashPattern *strokeColor);
95
void setFillPattern(SplashPattern *fillColor);
96
void setScreen(SplashScreen *screen);
97
void setLineWidth(SplashCoord lineWidth);
98
void setLineCap(int lineCap);
99
void setLineJoin(int lineJoin);
100
void setMiterLimit(SplashCoord miterLimit);
101
void setFlatness(SplashCoord flatness);
102
// the <lineDash> array will be copied
103
void setLineDash(SplashCoord *lineDash, int lineDashLength,
104
SplashCoord lineDashPhase);
105
void clipResetToRect(SplashCoord x0, SplashCoord y0,
106
SplashCoord x1, SplashCoord y1);
107
SplashError clipToPath(OPVPSplashPath *path, GBool eo);
109
//----- state save/restore
112
SplashError restoreState();
113
void restoreAllDriverState();
115
//----- drawing operations
117
// Fill the bitmap with <color>. This is not subject to clipping.
118
void clear(SplashColor color);
120
// Stroke a path using the current stroke pattern.
121
SplashError stroke(OPVPSplashPath *path);
123
// Fill a path using the current fill pattern.
124
SplashError fill(OPVPSplashPath *path, GBool eo);
126
// Draw a character, using the current fill pattern.
127
SplashError fillChar(SplashCoord x, SplashCoord y, int c,
128
SplashFont *font, Unicode *u, double *fontMat);
130
// Draw a glyph, using the current fill pattern. This function does
131
// not free any data, i.e., it ignores glyph->freeData.
132
// not used in vector mode
133
void fillGlyph(SplashCoord x, SplashCoord y,
134
SplashGlyphBitmap *glyph);
136
// Draws an image mask using the fill color. This will read <w>*<h>
137
// pixels from <src>, in raster order, starting with the top line.
138
// "1" pixels will be drawn with the current fill color; "0" pixels
139
// are transparent. The matrix:
140
// [ mat[0] mat[1] 0 ]
141
// [ mat[2] mat[3] 0 ]
142
// [ mat[4] mat[5] 1 ]
143
// maps a unit square to the desired destination for the image, in
145
// [x' y' 1] = [x y 1] * mat
146
// Note that the Splash y axis points downward, and the image source
147
// is assumed to produce pixels in raster order, starting from the
149
SplashError fillImageMask(SplashImageMaskSource src, void *srcData,
150
int w, int h, SplashCoord *mat, GBool glyphMode);
152
// Draw an image. This will read <w>*<h> pixels from <src>, in
153
// raster order, starting with the top line. These pixels are
154
// assumed to be in the source mode, <srcMode>. The following
155
// combinations of source and target modes are supported:
159
// Mono8 Mono1 -- with dithering
162
// BGR8packed BGR8Packed
163
// The matrix behaves as for fillImageMask.
164
SplashError drawImage(SplashImageSource src, void *srcData,
165
SplashColorMode srcMode, GBool srcAlpha,
166
int w, int h, SplashCoord *mat);
172
// Return the associated bitmap.
173
SplashBitmap *getBitmap() { return 0; }
175
// Toggle debug mode on or off.
176
void setDebugMode(GBool debugModeA) { debugMode = debugModeA; }
178
void setColorMode(int colorModeA);
179
void setStateBypass(GBool bypass) {stateBypass = bypass;}
181
SplashCoord *getMatrix();
182
void drawSpan(int x0, int x1, int y, GBool noClip);
183
#ifdef OLD_DRAW_IMAGE
184
void drawPixel(int x, int y, SplashColor *color, GBool noClip);
186
void drawPixel(int x, int y, GBool noClip);
187
void arcToCurve(SplashCoord x0, SplashCoord y0,
188
SplashCoord x3, SplashCoord y3,
189
SplashCoord cx, SplashCoord cy, SplashCoord *rx1, SplashCoord *ry1,
190
SplashCoord *rx2, SplashCoord *ry2);
193
void makeBrush(SplashPattern *pattern, opvp_brush_t *brush);
194
SplashError doClipPath(OPVPSplashPath *path, GBool eo,
195
OPVPClipPath *prevClip);
196
opvp_cspace_t getOPVPColorSpace();
197
GBool equalPattern(SplashPattern *pt1, SplashPattern *pt2);
198
SplashError makeRectanglePath(SplashCoord x0, SplashCoord y0,
199
SplashCoord x1, SplashCoord y1, OPVPSplashPath **p);
200
SplashError drawImageFastWithCTM(SplashImageSource src, void *srcData,
201
int w, int h, int tx, int ty,
203
SplashError drawImageNotShear(SplashImageSource src,
207
int scaledWidth, int scaledHeight,
208
int xSign, int ySign, GBool rot);
209
SplashError fillImageMaskFastWithCTM(SplashImageMaskSource src,
210
void *srcData, int w, int h, int tx, int ty,SplashCoord *mat);
211
SplashError strokeByMyself(OPVPSplashPath *path);
212
SplashError fillByMyself(OPVPSplashPath *path, GBool eo);
213
OPVPSplashXPath *makeDashedPath(OPVPSplashXPath *xPath);
214
void transform(SplashCoord *matrix, SplashCoord xi, SplashCoord yi,
215
SplashCoord *xo, SplashCoord *yo);
217
const char *getOption(const char *key, int nOptions, const char *optionKeys[],
218
const char *optionVals[]);
223
OPVPSplashState *state;
227
OPVPClipPath *clipPath;
230
GBool clipPathNotSaved;
235
GBool ignoreMiterLimit;
236
GBool savedNoClipPath;
238
int bitmapCharThreshold;
239
int maxClipPathLength;
240
int maxFillPathLength;
241
int saveDriverStateCount;