1
//========================================================================
5
// Copyright 1996-2003 Glyph & Cog, LLC
7
//========================================================================
9
//========================================================================
11
// Modified under the Poppler project - http://poppler.freedesktop.org
13
// All changes made under the Poppler project to this file are licensed
14
// under GPL version 2 or later
16
// Copyright (C) 2005 Jonathan Blandford <jrb@redhat.com>
17
// Copyright (C) 2006 Thorkild Stray <thorkild@ifi.uio.no>
18
// Copyright (C) 2007 Jeff Muizelaar <jeff@infidigm.net>
19
// Copyright (C) 2007 Adrian Johnson <ajohnson@redneon.com>
20
// Copyright (C) 2009, 2010 Thomas Freitag <Thomas.Freitag@alfa.de>
21
// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
22
// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org>
23
// Copyright (C) 2010 Christian Feuersļæ½nger <cfeuersaenger@googlemail.com>
25
// To see a description of the changes please see the Changelog file that
26
// came with your tarball or type make ChangeLog if you are building from git
28
//========================================================================
33
#ifdef USE_GCC_PRAGMAS
37
#include "poppler-config.h"
38
#include "goo/gtypes.h"
39
#include "CharTypes.h"
48
class GfxImageColorMap;
49
class GfxFunctionShading;
50
class GfxAxialShading;
51
class GfxGouraudTriangleShading;
52
class GfxPatchMeshShading;
53
class GfxRadialShading;
61
//------------------------------------------------------------------------
63
//------------------------------------------------------------------------
69
OutputDev() { profileHash = NULL; }
72
virtual ~OutputDev() {}
74
//----- get info about output device
76
// Does this device use upside-down coordinates?
77
// (Upside-down means (0,0) is the top left corner of the page.)
78
virtual GBool upsideDown() = 0;
80
// Does this device use drawChar() or drawString()?
81
virtual GBool useDrawChar() = 0;
83
// Does this device use tilingPatternFill()? If this returns false,
84
// tiling pattern fills will be reduced to a series of other drawing
86
virtual GBool useTilingPatternFill() { return gFalse; }
88
// Does this device support specific shading types?
89
// see gouraudTriangleShadedFill() and patchMeshShadedFill()
90
virtual GBool useShadedFills(int type) { return gFalse; }
92
// Does this device use FillColorStop()?
93
virtual GBool useFillColorStop() { return gFalse; }
95
// Does this device use drawForm()? If this returns false,
96
// form-type XObjects will be interpreted (i.e., unrolled).
97
virtual GBool useDrawForm() { return gFalse; }
99
// Does this device use beginType3Char/endType3Char? Otherwise,
100
// text in Type 3 fonts will be drawn with drawChar/drawString.
101
virtual GBool interpretType3Chars() = 0;
103
// Does this device need non-text content?
104
virtual GBool needNonText() { return gTrue; }
106
// If current colorspace ist pattern,
107
// does this device support text in pattern colorspace?
109
virtual GBool supportTextCSPattern(GfxState * /*state*/) { return gFalse; }
111
// If current colorspace ist pattern,
112
// need this device special handling for masks in pattern colorspace?
114
virtual GBool fillMaskCSPattern(GfxState * /*state*/) { return gFalse; }
115
virtual void endMaskClip(GfxState * /*state*/) {}
117
//----- initialization and control
119
// Set default transform matrix.
120
virtual void setDefaultCTM(double *ctm);
122
// Check to see if a page slice should be displayed. If this
123
// returns false, the page display is aborted. Typically, an
124
// OutputDev will use some alternate means to display the page
125
// before returning false.
126
virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
127
int rotate, GBool useMediaBox, GBool crop,
128
int sliceX, int sliceY, int sliceW, int sliceH,
129
GBool printing, Catalog * catalog,
130
GBool (* abortCheckCbk)(void *data) = NULL,
131
void * abortCheckCbkData = NULL)
135
virtual void startPage(int pageNum, GfxState *state) {}
138
virtual void endPage() {}
140
// Dump page contents to display.
141
virtual void dump() {}
143
//----- coordinate conversion
145
// Convert between device and user coordinates.
146
virtual void cvtDevToUser(double dx, double dy, double *ux, double *uy);
147
virtual void cvtUserToDev(double ux, double uy, int *dx, int *dy);
149
double *getDefCTM() { return defCTM; }
150
double *getDefICTM() { return defICTM; }
152
//----- save/restore graphics state
153
virtual void saveState(GfxState * /*state*/) {}
154
virtual void restoreState(GfxState * /*state*/) {}
156
//----- update graphics state
157
virtual void updateAll(GfxState *state);
158
virtual void updateCTM(GfxState * /*state*/, double /*m11*/, double /*m12*/,
159
double /*m21*/, double /*m22*/, double /*m31*/, double /*m32*/) {}
160
virtual void updateLineDash(GfxState * /*state*/) {}
161
virtual void updateFlatness(GfxState * /*state*/) {}
162
virtual void updateLineJoin(GfxState * /*state*/) {}
163
virtual void updateLineCap(GfxState * /*state*/) {}
164
virtual void updateMiterLimit(GfxState * /*state*/) {}
165
virtual void updateLineWidth(GfxState * /*state*/) {}
166
virtual void updateStrokeAdjust(GfxState * /*state*/) {}
167
virtual void updateAlphaIsShape(GfxState * /*state*/) {}
168
virtual void updateTextKnockout(GfxState * /*state*/) {}
169
virtual void updateFillColorSpace(GfxState * /*state*/) {}
170
virtual void updateStrokeColorSpace(GfxState * /*state*/) {}
171
virtual void updateFillColor(GfxState * /*state*/) {}
172
virtual void updateStrokeColor(GfxState * /*state*/) {}
173
virtual void updateBlendMode(GfxState * /*state*/) {}
174
virtual void updateFillOpacity(GfxState * /*state*/) {}
175
virtual void updateStrokeOpacity(GfxState * /*state*/) {}
176
virtual void updateFillOverprint(GfxState * /*state*/) {}
177
virtual void updateStrokeOverprint(GfxState * /*state*/) {}
178
virtual void updateTransfer(GfxState * /*state*/) {}
179
virtual void updateFillColorStop(GfxState * /*state*/, double /*offset*/) {}
181
//----- update text state
182
virtual void updateFont(GfxState * /*state*/) {}
183
virtual void updateTextMat(GfxState * /*state*/) {}
184
virtual void updateCharSpace(GfxState * /*state*/) {}
185
virtual void updateRender(GfxState * /*state*/) {}
186
virtual void updateRise(GfxState * /*state*/) {}
187
virtual void updateWordSpace(GfxState * /*state*/) {}
188
virtual void updateHorizScaling(GfxState * /*state*/) {}
189
virtual void updateTextPos(GfxState * /*state*/) {}
190
virtual void updateTextShift(GfxState * /*state*/, double /*shift*/) {}
192
//----- path painting
193
virtual void stroke(GfxState * /*state*/) {}
194
virtual void fill(GfxState * /*state*/) {}
195
virtual void eoFill(GfxState * /*state*/) {}
196
virtual GBool tilingPatternFill(GfxState * /*state*/, Object * /*str*/,
197
int /*paintType*/, Dict * /*resDict*/,
198
double * /*mat*/, double * /*bbox*/,
199
int /*x0*/, int /*y0*/, int /*x1*/, int /*y1*/,
200
double /*xStep*/, double /*yStep*/)
202
virtual GBool functionShadedFill(GfxState * /*state*/,
203
GfxFunctionShading * /*shading*/)
205
virtual GBool axialShadedFill(GfxState * /*state*/, GfxAxialShading * /*shading*/, double /*tMin*/, double /*tMax*/)
207
virtual GBool axialShadedSupportExtend(GfxState * /*state*/, GfxAxialShading * /*shading*/)
209
virtual GBool radialShadedFill(GfxState * /*state*/, GfxRadialShading * /*shading*/, double /*sMin*/, double /*sMax*/)
211
virtual GBool radialShadedSupportExtend(GfxState * /*state*/, GfxRadialShading * /*shading*/)
213
virtual GBool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading)
215
virtual GBool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading)
218
//----- path clipping
219
virtual void clip(GfxState * /*state*/) {}
220
virtual void eoClip(GfxState * /*state*/) {}
221
virtual void clipToStrokePath(GfxState * /*state*/) {}
224
virtual void beginStringOp(GfxState * /*state*/) {}
225
virtual void endStringOp(GfxState * /*state*/) {}
226
virtual void beginString(GfxState * /*state*/, GooString * /*s*/) {}
227
virtual void endString(GfxState * /*state*/) {}
228
virtual void drawChar(GfxState * /*state*/, double /*x*/, double /*y*/,
229
double /*dx*/, double /*dy*/,
230
double /*originX*/, double /*originY*/,
231
CharCode /*code*/, int /*nBytes*/, Unicode * /*u*/, int /*uLen*/) {}
232
virtual void drawString(GfxState * /*state*/, GooString * /*s*/) {}
233
virtual GBool beginType3Char(GfxState * /*state*/, double /*x*/, double /*y*/,
234
double /*dx*/, double /*dy*/,
235
CharCode /*code*/, Unicode * /*u*/, int /*uLen*/);
236
virtual void endType3Char(GfxState * /*state*/) {}
237
virtual void beginTextObject(GfxState * /*state*/) {}
238
virtual GBool deviceHasTextClip(GfxState * /*state*/) { return gFalse; }
239
virtual void endTextObject(GfxState * /*state*/) {}
241
//----- image drawing
242
virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
243
int width, int height, GBool invert, GBool interpolate,
245
virtual void drawImage(GfxState *state, Object *ref, Stream *str,
246
int width, int height, GfxImageColorMap *colorMap,
247
GBool interpolate, int *maskColors, GBool inlineImg);
248
virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
249
int width, int height,
250
GfxImageColorMap *colorMap, GBool interpolate,
251
Stream *maskStr, int maskWidth, int maskHeight,
252
GBool maskInvert, GBool maskInterpolate);
253
virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
254
int width, int height,
255
GfxImageColorMap *colorMap,
258
int maskWidth, int maskHeight,
259
GfxImageColorMap *maskColorMap,
260
GBool maskInterpolate);
262
//----- grouping operators
264
virtual void endMarkedContent(GfxState *state);
265
virtual void beginMarkedContent(char *name, Dict *properties);
266
virtual void markPoint(char *name);
267
virtual void markPoint(char *name, Dict *properties);
272
//----- OPI functions
273
virtual void opiBegin(GfxState *state, Dict *opiDict);
274
virtual void opiEnd(GfxState *state, Dict *opiDict);
277
//----- Type 3 font operators
278
virtual void type3D0(GfxState * /*state*/, double /*wx*/, double /*wy*/) {}
279
virtual void type3D1(GfxState * /*state*/, double /*wx*/, double /*wy*/,
280
double /*llx*/, double /*lly*/, double /*urx*/, double /*ury*/) {}
282
//----- form XObjects
283
virtual void drawForm(Ref /*id*/) {}
285
//----- PostScript XObjects
286
virtual void psXObject(Stream * /*psStream*/, Stream * /*level1Stream*/) {}
289
virtual void startProfile();
290
virtual GooHash *getProfileHash() {return profileHash; }
291
virtual GooHash *endProfile();
293
//----- transparency groups and soft masks
294
virtual void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/,
295
GfxColorSpace * /*blendingColorSpace*/,
296
GBool /*isolated*/, GBool /*knockout*/,
297
GBool /*forSoftMask*/) {}
298
virtual void endTransparencyGroup(GfxState * /*state*/) {}
299
virtual void paintTransparencyGroup(GfxState * /*state*/, double * /*bbox*/) {}
300
virtual void setSoftMask(GfxState * /*state*/, double * /*bbox*/, GBool /*alpha*/,
301
Function * /*transferFunc*/, GfxColor * /*backdropColor*/) {}
302
virtual void clearSoftMask(GfxState * /*state*/) {}
305
virtual void processLink(Link * /*link*/, Catalog * /*catalog*/) {}
307
#if 1 //~tmp: turn off anti-aliasing temporarily
308
virtual GBool getVectorAntialias() { return gFalse; }
309
virtual void setVectorAntialias(GBool /*vaa*/) {}
314
double defCTM[6]; // default coordinate transform matrix
315
double defICTM[6]; // inverse of default CTM
316
GooHash *profileHash;