1
//========================================================================
5
// Copyright 2005 AXE,Inc.
7
//========================================================================
9
#ifndef OPVPOUTPUTDEV_H
10
#define OPVPOUTPUTDEV_H
14
#ifdef USE_GCC_PRAGMAS
18
#include "goo/gtypes.h"
19
#include "splash/SplashTypes.h"
21
#include "OutputDev.h"
32
class SplashFontEngine;
35
struct T3FontCacheTag;
39
//------------------------------------------------------------------------
41
// number of Type 3 fonts to cache
42
#define splashOutT3FontCacheSize 8
44
//------------------------------------------------------------------------
46
//------------------------------------------------------------------------
48
class OPVPOutputDev: public OutputDev {
55
int init(SplashColorMode colorModeA, GBool colorProfile, GBool reverseVideoA,
56
SplashColor paperColorA,
57
const char *driverName, int outputFD,
58
const char *printerModel,
60
const char *optionKeys[], const char *optionVals[]);
63
virtual ~OPVPOutputDev();
65
//----- get info about output device
67
// Does this device use upside-down coordinates?
68
// (Upside-down means (0,0) is the top left corner of the page.)
69
virtual GBool upsideDown() { return gTrue; }
71
// Does this device use drawChar() or drawString()?
72
virtual GBool useDrawChar() { return gTrue; }
74
// Does this device use beginType3Char/endType3Char? Otherwise,
75
// text in Type 3 fonts will be drawn with drawChar/drawString.
76
virtual GBool interpretType3Chars() { return gTrue; }
78
//----- initialization and control
81
virtual void startPage(int pageNum, GfxState *state);
84
virtual void endPage();
86
//----- save/restore graphics state
87
virtual void saveState(GfxState *state);
88
virtual void restoreState(GfxState *state);
90
//----- update graphics state
91
virtual void updateAll(GfxState *state);
92
virtual void updateCTM(GfxState *state, double m11, double m12,
93
double m21, double m22, double m31, double m32);
94
virtual void updateLineDash(GfxState *state);
95
virtual void updateFlatness(GfxState *state);
96
virtual void updateLineJoin(GfxState *state);
97
virtual void updateLineCap(GfxState *state);
98
virtual void updateMiterLimit(GfxState *state);
99
virtual void updateLineWidth(GfxState *state);
100
virtual void updateFillColor(GfxState *state);
101
virtual void updateStrokeColor(GfxState *state);
103
//----- update text state
104
virtual void updateFont(GfxState *state);
106
//----- path painting
107
virtual void stroke(GfxState *state);
108
virtual void fill(GfxState *state);
109
virtual void eoFill(GfxState *state);
111
//----- path clipping
112
virtual void clip(GfxState *state);
113
virtual void eoClip(GfxState *state);
114
virtual void clipToStrokePath(GfxState *state);
117
virtual void drawChar(GfxState *state, double x, double y,
118
double dx, double dy,
119
double originX, double originY,
120
CharCode code, int nBytes, Unicode *u, int uLen);
121
virtual GBool beginType3Char(GfxState *state, double x, double y,
122
double dx, double dy,
123
CharCode code, Unicode *u, int uLen);
124
virtual void endType3Char(GfxState *state);
125
virtual void endTextObject(GfxState *state);
127
//----- image drawing
128
virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
129
int width, int height, GBool invert,
132
virtual void drawImage(GfxState *state, Object *ref, Stream *str,
133
int width, int height, GfxImageColorMap *colorMap,
135
int *maskColors, GBool inlineImg);
136
virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
137
int width, int height,
138
GfxImageColorMap *colorMap,
140
Stream *maskStr, int maskWidth, int maskHeight,
141
GBool maskInvert, GBool maskeInterpolate);
142
virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
143
int width, int height,
144
GfxImageColorMap *colorMap,
147
int maskWidth, int maskHeight,
148
GfxImageColorMap *maskColorMap,
149
GBool maskInterpolate);
151
//----- Type 3 font operators
152
virtual void type3D0(GfxState *state, double wx, double wy);
153
virtual void type3D1(GfxState *state, double wx, double wy,
154
double llx, double lly, double urx, double ury);
156
//----- special access
158
// Called to indicate that a new PDF document has been loaded.
159
void startDoc(XRef *xrefA);
161
GBool isReverseVideo() { return reverseVideo; }
163
// Get the bitmap and its size.
164
SplashBitmap *getBitmap() { return bitmap; }
165
int getBitmapWidth();
166
int getBitmapHeight();
168
// Get the Splash object.
169
OPRS *getOPRS() { return oprs; }
171
// XOR a rectangular region in the bitmap with <pattern>. <pattern>
172
// is passed to Splash::setFillPattern, so it should not be used
173
// after calling this function.
174
void xorRectangle(int x0, int y0, int x1, int y1, SplashPattern *pattern);
176
// Set the Splash fill color.
177
void setFillColor(int r, int g, int b);
179
void setUnderlayCbk(void (*cbk)(void *data), void *data)
180
{ underlayCbk = cbk; underlayCbkData = data; }
182
int OPVPStartJob(char *jobInfo);
184
int OPVPStartDoc(char *docInfo);
186
int OPVPStartPage(char *pageInfo, int rasterWidth, int rasterHeight);
189
virtual void psXObject(Stream *psStream, Stream *level1Stream);
190
void setScale(double w, double h, double leftMarginA, double bottomMarginA,
191
int rotateA, int yoffsetA, int sliceHeightA);
195
SplashPattern *getColor(GfxGray gray, GfxRGB *rgb);
196
OPVPSplashPath *convertPath(GfxState *state, GfxPath *path);
197
void drawType3Glyph(T3FontCache *t3Font,
198
T3FontCacheTag *tag, Guchar *data,
200
void patternFillChar(GfxState *state,
201
double x, double y, CharCode code);
203
static GBool imageMaskSrc(void *data, SplashColorPtr line);
204
static GBool imageSrc(void *data, SplashColorPtr line,
206
static GBool alphaImageSrc(void *data, SplashColorPtr line,
208
static GBool maskedImageSrc(void *data, SplashColorPtr line,
211
OPVPSplashPath *bitmapToPath(SplashBitmap *bitmapA, int width, int height);
212
void closeAllSubPath(OPVPSplashPath *path);
213
void patternFillImageMask(GfxState *state,
214
SplashImageMaskSource src, void *srcData, int w, int h, SplashCoord *mat);
215
void doUpdateFont(GfxState *state);
216
void transLineDash(GfxState *state, SplashCoord **adash,
217
int *adashLength, SplashCoord *aphase);
218
void updateSplashLineDash(GfxState *state, Splash *splash);
220
SplashColorMode colorMode;
221
GBool reverseVideo; // reverse video mode
222
SplashColor paperColor; // paper color
224
XRef *xref; // xref table for current document
226
SplashBitmap *bitmap;
228
SplashFontEngine *fontEngine;
230
T3FontCache * // Type 3 font cache
231
t3FontCache[splashOutT3FontCacheSize];
232
int nT3Fonts; // number of valid entries in t3FontCache
233
T3GlyphStack *t3GlyphStack; // Type 3 glyph context stack
235
SplashFont *font; // current font
236
GBool needFontUpdate; // set when the font needs to be updated
237
OPVPSplashPath *textClipPath; // clipping path built with text object
239
void (*underlayCbk)(void *data);
240
void *underlayCbkData;
242
double scaleWidth, scaleHeight;
243
int paperWidth, paperHeight;
244
double leftMargin, bottomMargin;