1
//========================================================================
5
//========================================================================
12
#ifdef USE_GCC_PRAGMAS
16
#include "splash/SplashTypes.h"
17
#include "opvp_common.h"
18
#include "splash/Splash.h"
19
#include "OPVPSplash.h"
20
#include "OPVPWrapper.h"
22
#define OPVP_BUFF_SIZE 256
25
class SplashGlyphBitmap;
34
//------------------------------------------------------------------------
36
//------------------------------------------------------------------------
41
static void error(const char *msg, ...);
45
int setBitmap(SplashBitmap *bitmapA);
49
SplashPattern *getStrokePattern();
50
SplashPattern *getFillPattern();
51
SplashScreen *getScreen();
52
SplashCoord getLineWidth();
55
SplashCoord getMiterLimit();
56
SplashCoord getFlatness();
57
SplashCoord *getLineDash();
58
int getLineDashLength();
59
SplashCoord getLineDashPhase();
60
OPVPSplashClip *getClip();
64
void setStrokePattern(SplashPattern *strokeColor);
65
void setFillPattern(SplashPattern *fillColor);
66
void setScreen(SplashScreen *screen);
67
void setLineWidth(SplashCoord lineWidth);
68
void setMiterLimit(SplashCoord miterLimit);
69
void setLineCap(int lineCap);
70
void setLineJoin(int lineJoin);
71
void setFlatness(SplashCoord flatness);
72
// the <lineDash> array will be copied
73
void setLineDash(SplashCoord *lineDash, int lineDashLength,
74
SplashCoord lineDashPhase);
75
SplashError clipToPath(OPVPSplashPath *path, GBool eo);
77
//----- state save/restore
80
SplashError restoreState();
82
void setSoftMask(SplashBitmap *softMaskA);
84
//----- drawing operations
86
// Fill the bitmap with <color>. This is not subject to clipping.
87
void clear(SplashColor color);
89
// Stroke a path using the current stroke pattern.
90
SplashError stroke(OPVPSplashPath *path);
92
// Fill a path using the current fill pattern.
93
SplashError fill(OPVPSplashPath *path, GBool eo);
95
// Draw a character, using the current fill pattern.
96
SplashError fillChar(SplashCoord x, SplashCoord y, int c, SplashFont *font,
97
Unicode *u, double *fontMat);
99
// Draw a glyph, using the current fill pattern. This function does
100
// not free any data, i.e., it ignores glyph->freeData.
101
SplashError fillGlyph(SplashCoord x, SplashCoord y,
102
SplashGlyphBitmap *glyph);
104
// Draws an image mask using the fill color. This will read <w>*<h>
105
// pixels from <src>, in raster order, starting with the top line.
106
// "1" pixels will be drawn with the current fill color; "0" pixels
107
// are transparent. The matrix:
108
// [ mat[0] mat[1] 0 ]
109
// [ mat[2] mat[3] 0 ]
110
// [ mat[4] mat[5] 1 ]
111
// maps a unit square to the desired destination for the image, in
113
// [x' y' 1] = [x y 1] * mat
114
// Note that the Splash y axis points downward, and the image source
115
// is assumed to produce pixels in raster order, starting from the
117
SplashError fillImageMask(SplashImageMaskSource src, void *srcData,
118
int w, int h, SplashCoord *mat, GBool glyphMode);
120
// Draw an image. This will read <w>*<h> pixels from <src>, in
121
// raster order, starting with the top line. These pixels are
122
// assumed to be in the source mode, <srcMode>. The following
123
// combinations of source and target modes are supported:
127
// Mono8 Mono1 -- with dithering
130
// BGR8packed BGR8Packed
131
// The matrix behaves as for fillImageMask.
132
SplashError drawImage(SplashImageSource src, void *srcData,
133
SplashColorMode srcMode, GBool srcAlpha,
134
int w, int h, SplashCoord *mat);
140
// Return the associated bitmap.
141
SplashBitmap *getBitmap();
143
// Toggle debug mode on or off.
144
void setDebugMode(GBool debugModeA);
146
int init(const char *driverName, int outputFD,
147
const char *printerModel, int nOptions,
148
const char *optionKeys[], const char *optionVals[]);
149
void initGS(int colorMode, int w, int h, SplashColor paperColor);
150
int setColorMode(int colorModeA, GBool colorProfile);
151
int unloadVectorDriver();
153
int OPVPStartJob(char *jobInfo);
155
int OPVPStartDoc(char *docInfo);
157
int OPVPStartPage(char *pageInfo, int rasterWidth);
160
Splash *getSplash() { return splash; }
161
int getRasterMode() { return rasterMode; }
163
SplashCoord *getMatrix();
167
OPVPSplash *opvpSplash;
170
int getRasterSize(SplashBitmap *bitmap);
172
typedef unsigned char *(*GetScanLineDataFunT)(unsigned char *dst,
173
unsigned char *bitmap, int rasterWidth);
175
static unsigned char *getScanLineDataMono1(unsigned char *dst,
176
unsigned char *bitmap, int rasterWidth);
177
static unsigned char *getScanLineDataMono8(unsigned char *dst,
178
unsigned char *bitmap, int rasterWidth);
179
static unsigned char *getScanLineDataRGB8(unsigned char *dst,
180
unsigned char *bitmap, int rasterWidth);
181
static unsigned char *getScanLineDataBGR8Packed(unsigned char *dst,
182
unsigned char *bitmap, int rasterWidth);
184
GetScanLineDataFunT getGetScanLineDataFun(SplashBitmap *bitmap);
185
GBool checkAll1(unsigned char *bp, int n, int width, int mode);