beta-0.89.2
[luatex.git] / source / libs / poppler / poppler-src / poppler / OutputDev.h
bloba15d56b147709a1f8925114635d8b9fafd1104cd
1 //========================================================================
2 //
3 // OutputDev.h
4 //
5 // Copyright 1996-2003 Glyph & Cog, LLC
6 //
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 //========================================================================
32 #ifndef OUTPUTDEV_H
33 #define OUTPUTDEV_H
35 #ifdef USE_GCC_PRAGMAS
36 #pragma interface
37 #endif
39 #include "poppler-config.h"
40 #include "goo/gtypes.h"
41 #include "CharTypes.h"
42 #include "Object.h"
43 #include "PopplerCache.h"
45 class Annot;
46 class Dict;
47 class GooHash;
48 class GooString;
49 class GfxState;
50 class Gfx;
51 struct GfxColor;
52 class GfxColorSpace;
53 class GfxImageColorMap;
54 class GfxFunctionShading;
55 class GfxAxialShading;
56 class GfxGouraudTriangleShading;
57 class GfxPatchMeshShading;
58 class GfxRadialShading;
59 class GfxGouraudTriangleShading;
60 class GfxPatchMeshShading;
61 class Stream;
62 class Links;
63 class AnnotLink;
64 class Catalog;
65 class Page;
66 class Function;
68 //------------------------------------------------------------------------
69 // OutputDev
70 //------------------------------------------------------------------------
72 class OutputDev {
73 public:
75 // Constructor.
76 OutputDev()
77 #ifdef USE_CMS
78 : iccColorSpaceCache(5)
79 #endif
81 profileHash = NULL;
84 // Destructor.
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
98 // operations.
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
120 // non-shown layers?
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,
139 GBool printing,
140 GBool (* abortCheckCbk)(void *data) = NULL,
141 void * abortCheckCbkData = NULL,
142 GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = NULL,
143 void *annotDisplayDecideCbkData = NULL)
144 { return gTrue; }
146 // Start a page.
147 virtual void startPage(int pageNum, GfxState *state, XRef *xref) {}
149 // End a page.
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*/)
218 { return gFalse; }
219 virtual GBool functionShadedFill(GfxState * /*state*/,
220 GfxFunctionShading * /*shading*/)
221 { return gFalse; }
222 virtual GBool axialShadedFill(GfxState * /*state*/, GfxAxialShading * /*shading*/, double /*tMin*/, double /*tMax*/)
223 { return gFalse; }
224 virtual GBool axialShadedSupportExtend(GfxState * /*state*/, GfxAxialShading * /*shading*/)
225 { return gFalse; }
226 virtual GBool radialShadedFill(GfxState * /*state*/, GfxRadialShading * /*shading*/, double /*sMin*/, double /*sMax*/)
227 { return gFalse; }
228 virtual GBool radialShadedSupportExtend(GfxState * /*state*/, GfxRadialShading * /*shading*/)
229 { return gFalse; }
230 virtual GBool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading)
231 { return gFalse; }
232 virtual GBool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading)
233 { return gFalse; }
235 //----- path clipping
236 virtual void clip(GfxState * /*state*/) {}
237 virtual void eoClip(GfxState * /*state*/) {}
238 virtual void clipToStrokePath(GfxState * /*state*/) {}
240 //----- text drawing
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,
263 GBool inlineImg);
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,
280 GBool interpolate,
281 Stream *maskStr,
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);
295 #if OPI_SUPPORT
296 //----- OPI functions
297 virtual void opiBegin(GfxState *state, Dict *opiDict);
298 virtual void opiEnd(GfxState *state, Dict *opiDict);
299 #endif
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*/) {}
312 //----- Profiling
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*/) {}
329 //----- links
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*/) {}
335 #endif
337 #ifdef USE_CMS
338 PopplerCache *getIccColorSpaceCache();
339 #endif
341 private:
343 double defCTM[6]; // default coordinate transform matrix
344 double defICTM[6]; // inverse of default CTM
345 GooHash *profileHash;
347 #ifdef USE_CMS
348 PopplerCache iccColorSpaceCache;
349 #endif
352 #endif