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, 2011 Adrian Johnson <ajohnson@redneon.com>
20 // Copyright (C) 2009-2013, 2015 Thomas Freitag <Thomas.Freitag@alfa.de>
21 // Copyright (C) 2009, 2011 Carlos Garcia Campos <carlosgc@gnome.org>
22 // Copyright (C) 2009, 2012, 2013 Albert Astals Cid <aacid@kde.org>
23 // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com>
24 // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it>
25 // Copyright (C) 2012 William Bader <williambader@hotmail.com>
27 // To see a description of the changes please see the Changelog file that
28 // came with your tarball or type make ChangeLog if you are building from git
30 //========================================================================
35 #ifdef USE_GCC_PRAGMAS
39 #include "poppler-config.h"
40 #include "goo/gtypes.h"
41 #include "CharTypes.h"
43 #include "PopplerCache.h"
53 class GfxImageColorMap
;
54 class GfxFunctionShading
;
55 class GfxAxialShading
;
56 class GfxGouraudTriangleShading
;
57 class GfxPatchMeshShading
;
58 class GfxRadialShading
;
59 class GfxGouraudTriangleShading
;
60 class GfxPatchMeshShading
;
68 //------------------------------------------------------------------------
70 //------------------------------------------------------------------------
78 : iccColorSpaceCache(5)
85 virtual ~OutputDev() {}
87 //----- get info about output device
89 // Does this device use upside-down coordinates?
90 // (Upside-down means (0,0) is the top left corner of the page.)
91 virtual GBool
upsideDown() = 0;
93 // Does this device use drawChar() or drawString()?
94 virtual GBool
useDrawChar() = 0;
96 // Does this device use tilingPatternFill()? If this returns false,
97 // tiling pattern fills will be reduced to a series of other drawing
99 virtual GBool
useTilingPatternFill() { return gFalse
; }
101 // Does this device support specific shading types?
102 // see gouraudTriangleShadedFill() and patchMeshShadedFill()
103 virtual GBool
useShadedFills(int type
) { return gFalse
; }
105 // Does this device use FillColorStop()?
106 virtual GBool
useFillColorStop() { return gFalse
; }
108 // Does this device use drawForm()? If this returns false,
109 // form-type XObjects will be interpreted (i.e., unrolled).
110 virtual GBool
useDrawForm() { return gFalse
; }
112 // Does this device use beginType3Char/endType3Char? Otherwise,
113 // text in Type 3 fonts will be drawn with drawChar/drawString.
114 virtual GBool
interpretType3Chars() = 0;
116 // Does this device need non-text content?
117 virtual GBool
needNonText() { return gTrue
; }
119 // Does this device require incCharCount to be called for text on
121 virtual GBool
needCharCount() { return gFalse
; }
123 // Does this device need to clip pages to the crop box even when the
124 // box is the crop box?
125 virtual GBool
needClipToCropBox() { return gFalse
; }
127 //----- initialization and control
129 // Set default transform matrix.
130 virtual void setDefaultCTM(double *ctm
);
132 // Check to see if a page slice should be displayed. If this
133 // returns false, the page display is aborted. Typically, an
134 // OutputDev will use some alternate means to display the page
135 // before returning false.
136 virtual GBool
checkPageSlice(Page
*page
, double hDPI
, double vDPI
,
137 int rotate
, GBool useMediaBox
, GBool crop
,
138 int sliceX
, int sliceY
, int sliceW
, int sliceH
,
140 GBool (* abortCheckCbk
)(void *data
) = NULL
,
141 void * abortCheckCbkData
= NULL
,
142 GBool (*annotDisplayDecideCbk
)(Annot
*annot
, void *user_data
) = NULL
,
143 void *annotDisplayDecideCbkData
= NULL
)
147 virtual void startPage(int pageNum
, GfxState
*state
, XRef
*xref
) {}
150 virtual void endPage() {}
152 // Dump page contents to display.
153 virtual void dump() {}
155 //----- coordinate conversion
157 // Convert between device and user coordinates.
158 virtual void cvtDevToUser(double dx
, double dy
, double *ux
, double *uy
);
159 virtual void cvtUserToDev(double ux
, double uy
, int *dx
, int *dy
);
161 double *getDefCTM() { return defCTM
; }
162 double *getDefICTM() { return defICTM
; }
164 //----- save/restore graphics state
165 virtual void saveState(GfxState
* /*state*/) {}
166 virtual void restoreState(GfxState
* /*state*/) {}
168 //----- update graphics state
169 virtual void updateAll(GfxState
*state
);
170 virtual void updateCTM(GfxState
* /*state*/, double /*m11*/, double /*m12*/,
171 double /*m21*/, double /*m22*/, double /*m31*/, double /*m32*/) {}
172 virtual void updateLineDash(GfxState
* /*state*/) {}
173 virtual void updateFlatness(GfxState
* /*state*/) {}
174 virtual void updateLineJoin(GfxState
* /*state*/) {}
175 virtual void updateLineCap(GfxState
* /*state*/) {}
176 virtual void updateMiterLimit(GfxState
* /*state*/) {}
177 virtual void updateLineWidth(GfxState
* /*state*/) {}
178 virtual void updateStrokeAdjust(GfxState
* /*state*/) {}
179 virtual void updateAlphaIsShape(GfxState
* /*state*/) {}
180 virtual void updateTextKnockout(GfxState
* /*state*/) {}
181 virtual void updateFillColorSpace(GfxState
* /*state*/) {}
182 virtual void updateStrokeColorSpace(GfxState
* /*state*/) {}
183 virtual void updateFillColor(GfxState
* /*state*/) {}
184 virtual void updateStrokeColor(GfxState
* /*state*/) {}
185 virtual void updateBlendMode(GfxState
* /*state*/) {}
186 virtual void updateFillOpacity(GfxState
* /*state*/) {}
187 virtual void updateStrokeOpacity(GfxState
* /*state*/) {}
188 virtual void updatePatternOpacity(GfxState
* /*state*/) {}
189 virtual void clearPatternOpacity(GfxState
* /*state*/) {}
190 virtual void updateFillOverprint(GfxState
* /*state*/) {}
191 virtual void updateStrokeOverprint(GfxState
* /*state*/) {}
192 virtual void updateOverprintMode(GfxState
* /*state*/) {}
193 virtual void updateTransfer(GfxState
* /*state*/) {}
194 virtual void updateFillColorStop(GfxState
* /*state*/, double /*offset*/) {}
196 //----- update text state
197 virtual void updateFont(GfxState
* /*state*/) {}
198 virtual void updateTextMat(GfxState
* /*state*/) {}
199 virtual void updateCharSpace(GfxState
* /*state*/) {}
200 virtual void updateRender(GfxState
* /*state*/) {}
201 virtual void updateRise(GfxState
* /*state*/) {}
202 virtual void updateWordSpace(GfxState
* /*state*/) {}
203 virtual void updateHorizScaling(GfxState
* /*state*/) {}
204 virtual void updateTextPos(GfxState
* /*state*/) {}
205 virtual void updateTextShift(GfxState
* /*state*/, double /*shift*/) {}
206 virtual void saveTextPos(GfxState
* /*state*/) {}
207 virtual void restoreTextPos(GfxState
* /*state*/) {}
209 //----- path painting
210 virtual void stroke(GfxState
* /*state*/) {}
211 virtual void fill(GfxState
* /*state*/) {}
212 virtual void eoFill(GfxState
* /*state*/) {}
213 virtual GBool
tilingPatternFill(GfxState
* /*state*/, Gfx
* /*gfx*/, Catalog
* /*cat*/, Object
* /*str*/,
214 double * /*pmat*/, int /*paintType*/, int /*tilingType*/, Dict
* /*resDict*/,
215 double * /*mat*/, double * /*bbox*/,
216 int /*x0*/, int /*y0*/, int /*x1*/, int /*y1*/,
217 double /*xStep*/, double /*yStep*/)
219 virtual GBool
functionShadedFill(GfxState
* /*state*/,
220 GfxFunctionShading
* /*shading*/)
222 virtual GBool
axialShadedFill(GfxState
* /*state*/, GfxAxialShading
* /*shading*/, double /*tMin*/, double /*tMax*/)
224 virtual GBool
axialShadedSupportExtend(GfxState
* /*state*/, GfxAxialShading
* /*shading*/)
226 virtual GBool
radialShadedFill(GfxState
* /*state*/, GfxRadialShading
* /*shading*/, double /*sMin*/, double /*sMax*/)
228 virtual GBool
radialShadedSupportExtend(GfxState
* /*state*/, GfxRadialShading
* /*shading*/)
230 virtual GBool
gouraudTriangleShadedFill(GfxState
*state
, GfxGouraudTriangleShading
*shading
)
232 virtual GBool
patchMeshShadedFill(GfxState
*state
, GfxPatchMeshShading
*shading
)
235 //----- path clipping
236 virtual void clip(GfxState
* /*state*/) {}
237 virtual void eoClip(GfxState
* /*state*/) {}
238 virtual void clipToStrokePath(GfxState
* /*state*/) {}
241 virtual void beginStringOp(GfxState
* /*state*/) {}
242 virtual void endStringOp(GfxState
* /*state*/) {}
243 virtual void beginString(GfxState
* /*state*/, GooString
* /*s*/) {}
244 virtual void endString(GfxState
* /*state*/) {}
245 virtual void drawChar(GfxState
* /*state*/, double /*x*/, double /*y*/,
246 double /*dx*/, double /*dy*/,
247 double /*originX*/, double /*originY*/,
248 CharCode
/*code*/, int /*nBytes*/, Unicode
* /*u*/, int /*uLen*/) {}
249 virtual void drawString(GfxState
* /*state*/, GooString
* /*s*/) {}
250 virtual GBool
beginType3Char(GfxState
* /*state*/, double /*x*/, double /*y*/,
251 double /*dx*/, double /*dy*/,
252 CharCode
/*code*/, Unicode
* /*u*/, int /*uLen*/);
253 virtual void endType3Char(GfxState
* /*state*/) {}
254 virtual void beginTextObject(GfxState
* /*state*/) {}
255 virtual void endTextObject(GfxState
* /*state*/) {}
256 virtual void incCharCount(int /*nChars*/) {}
257 virtual void beginActualText(GfxState
* /*state*/, GooString
* /*text*/ ) {}
258 virtual void endActualText(GfxState
* /*state*/) {}
260 //----- image drawing
261 virtual void drawImageMask(GfxState
*state
, Object
*ref
, Stream
*str
,
262 int width
, int height
, GBool invert
, GBool interpolate
,
264 virtual void setSoftMaskFromImageMask(GfxState
*state
,
265 Object
*ref
, Stream
*str
,
266 int width
, int height
, GBool invert
,
267 GBool inlineImg
, double *baseMatrix
);
268 virtual void unsetSoftMaskFromImageMask(GfxState
*state
, double *baseMatrix
);
269 virtual void drawImage(GfxState
*state
, Object
*ref
, Stream
*str
,
270 int width
, int height
, GfxImageColorMap
*colorMap
,
271 GBool interpolate
, int *maskColors
, GBool inlineImg
);
272 virtual void drawMaskedImage(GfxState
*state
, Object
*ref
, Stream
*str
,
273 int width
, int height
,
274 GfxImageColorMap
*colorMap
, GBool interpolate
,
275 Stream
*maskStr
, int maskWidth
, int maskHeight
,
276 GBool maskInvert
, GBool maskInterpolate
);
277 virtual void drawSoftMaskedImage(GfxState
*state
, Object
*ref
, Stream
*str
,
278 int width
, int height
,
279 GfxImageColorMap
*colorMap
,
282 int maskWidth
, int maskHeight
,
283 GfxImageColorMap
*maskColorMap
,
284 GBool maskInterpolate
);
286 //----- grouping operators
288 virtual void endMarkedContent(GfxState
*state
);
289 virtual void beginMarkedContent(char *name
, Dict
*properties
);
290 virtual void markPoint(char *name
);
291 virtual void markPoint(char *name
, Dict
*properties
);
296 //----- OPI functions
297 virtual void opiBegin(GfxState
*state
, Dict
*opiDict
);
298 virtual void opiEnd(GfxState
*state
, Dict
*opiDict
);
301 //----- Type 3 font operators
302 virtual void type3D0(GfxState
* /*state*/, double /*wx*/, double /*wy*/) {}
303 virtual void type3D1(GfxState
* /*state*/, double /*wx*/, double /*wy*/,
304 double /*llx*/, double /*lly*/, double /*urx*/, double /*ury*/) {}
306 //----- form XObjects
307 virtual void drawForm(Ref
/*id*/) {}
309 //----- PostScript XObjects
310 virtual void psXObject(Stream
* /*psStream*/, Stream
* /*level1Stream*/) {}
313 virtual void startProfile();
314 virtual GooHash
*getProfileHash() {return profileHash
; }
315 virtual GooHash
*endProfile();
317 //----- transparency groups and soft masks
318 virtual GBool
checkTransparencyGroup(GfxState
* /*state*/, GBool
/*knockout*/) { return gTrue
; }
319 virtual void beginTransparencyGroup(GfxState
* /*state*/, double * /*bbox*/,
320 GfxColorSpace
* /*blendingColorSpace*/,
321 GBool
/*isolated*/, GBool
/*knockout*/,
322 GBool
/*forSoftMask*/) {}
323 virtual void endTransparencyGroup(GfxState
* /*state*/) {}
324 virtual void paintTransparencyGroup(GfxState
* /*state*/, double * /*bbox*/) {}
325 virtual void setSoftMask(GfxState
* /*state*/, double * /*bbox*/, GBool
/*alpha*/,
326 Function
* /*transferFunc*/, GfxColor
* /*backdropColor*/) {}
327 virtual void clearSoftMask(GfxState
* /*state*/) {}
330 virtual void processLink(AnnotLink
* /*link*/) {}
332 #if 1 //~tmp: turn off anti-aliasing temporarily
333 virtual GBool
getVectorAntialias() { return gFalse
; }
334 virtual void setVectorAntialias(GBool
/*vaa*/) {}
338 PopplerCache
*getIccColorSpaceCache();
343 double defCTM
[6]; // default coordinate transform matrix
344 double defICTM
[6]; // inverse of default CTM
345 GooHash
*profileHash
;
348 PopplerCache iccColorSpaceCache
;