~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tests/poppler/poppler/OutputDev.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//========================================================================
 
2
//
 
3
// OutputDev.h
 
4
//
 
5
// Copyright 1996-2003 Glyph & Cog, LLC
 
6
//
 
7
//========================================================================
 
8
 
 
9
//========================================================================
 
10
//
 
11
// Modified under the Poppler project - http://poppler.freedesktop.org
 
12
//
 
13
// All changes made under the Poppler project to this file are licensed
 
14
// under GPL version 2 or later
 
15
//
 
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>
 
24
//
 
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
 
27
//
 
28
//========================================================================
 
29
 
 
30
#ifndef OUTPUTDEV_H
 
31
#define OUTPUTDEV_H
 
32
 
 
33
#ifdef USE_GCC_PRAGMAS
 
34
#pragma interface
 
35
#endif
 
36
 
 
37
#include "poppler-config.h"
 
38
#include "goo/gtypes.h"
 
39
#include "CharTypes.h"
 
40
#include "Object.h"
 
41
 
 
42
class Dict;
 
43
class GooHash;
 
44
class GooString;
 
45
class GfxState;
 
46
struct GfxColor;
 
47
class GfxColorSpace;
 
48
class GfxImageColorMap;
 
49
class GfxFunctionShading;
 
50
class GfxAxialShading;
 
51
class GfxGouraudTriangleShading;
 
52
class GfxPatchMeshShading;
 
53
class GfxRadialShading;
 
54
class Stream;
 
55
class Links;
 
56
class Link;
 
57
class Catalog;
 
58
class Page;
 
59
class Function;
 
60
 
 
61
//------------------------------------------------------------------------
 
62
// OutputDev
 
63
//------------------------------------------------------------------------
 
64
 
 
65
class OutputDev {
 
66
public:
 
67
 
 
68
  // Constructor.
 
69
  OutputDev() { profileHash = NULL; }
 
70
 
 
71
  // Destructor.
 
72
  virtual ~OutputDev() {}
 
73
 
 
74
  //----- get info about output device
 
75
 
 
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;
 
79
 
 
80
  // Does this device use drawChar() or drawString()?
 
81
  virtual GBool useDrawChar() = 0;
 
82
 
 
83
  // Does this device use tilingPatternFill()?  If this returns false,
 
84
  // tiling pattern fills will be reduced to a series of other drawing
 
85
  // operations.
 
86
  virtual GBool useTilingPatternFill() { return gFalse; }
 
87
 
 
88
  // Does this device support specific shading types?
 
89
  // see gouraudTriangleShadedFill() and patchMeshShadedFill()
 
90
  virtual GBool useShadedFills(int type) { return gFalse; }
 
91
 
 
92
  // Does this device use FillColorStop()?
 
93
  virtual GBool useFillColorStop() { return gFalse; }
 
94
 
 
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; }
 
98
 
 
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;
 
102
 
 
103
  // Does this device need non-text content?
 
104
  virtual GBool needNonText() { return gTrue; }
 
105
 
 
106
  // If current colorspace ist pattern,
 
107
  // does this device support text in pattern colorspace?
 
108
  // Default is false
 
109
  virtual GBool supportTextCSPattern(GfxState * /*state*/) { return gFalse; }
 
110
 
 
111
  // If current colorspace ist pattern,
 
112
  // need this device special handling for masks in pattern colorspace?
 
113
  // Default is false
 
114
  virtual GBool fillMaskCSPattern(GfxState * /*state*/) { return gFalse; }
 
115
  virtual void endMaskClip(GfxState * /*state*/) {}
 
116
 
 
117
  //----- initialization and control
 
118
 
 
119
  // Set default transform matrix.
 
120
  virtual void setDefaultCTM(double *ctm);
 
121
 
 
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)
 
132
    { return gTrue; }
 
133
 
 
134
  // Start a page.
 
135
  virtual void startPage(int pageNum, GfxState *state) {}
 
136
 
 
137
  // End a page.
 
138
  virtual void endPage() {}
 
139
 
 
140
  // Dump page contents to display.
 
141
  virtual void dump() {}
 
142
 
 
143
  //----- coordinate conversion
 
144
 
 
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);
 
148
 
 
149
  double *getDefCTM() { return defCTM; }
 
150
  double *getDefICTM() { return defICTM; }
 
151
 
 
152
  //----- save/restore graphics state
 
153
  virtual void saveState(GfxState * /*state*/) {}
 
154
  virtual void restoreState(GfxState * /*state*/) {}
 
155
 
 
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*/) {}
 
180
 
 
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*/) {}
 
191
 
 
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*/)
 
201
    { return gFalse; }
 
202
  virtual GBool functionShadedFill(GfxState * /*state*/,
 
203
                                   GfxFunctionShading * /*shading*/)
 
204
    { return gFalse; }
 
205
  virtual GBool axialShadedFill(GfxState * /*state*/, GfxAxialShading * /*shading*/, double /*tMin*/, double /*tMax*/)
 
206
    { return gFalse; }
 
207
  virtual GBool axialShadedSupportExtend(GfxState * /*state*/, GfxAxialShading * /*shading*/)
 
208
    { return gFalse; }
 
209
  virtual GBool radialShadedFill(GfxState * /*state*/, GfxRadialShading * /*shading*/, double /*sMin*/, double /*sMax*/)
 
210
    { return gFalse; }
 
211
  virtual GBool radialShadedSupportExtend(GfxState * /*state*/, GfxRadialShading * /*shading*/)
 
212
    { return gFalse; }
 
213
  virtual GBool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading)
 
214
    { return gFalse; }
 
215
  virtual GBool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading)
 
216
    { return gFalse; }
 
217
 
 
218
  //----- path clipping
 
219
  virtual void clip(GfxState * /*state*/) {}
 
220
  virtual void eoClip(GfxState * /*state*/) {}
 
221
  virtual void clipToStrokePath(GfxState * /*state*/) {}
 
222
 
 
223
  //----- text drawing
 
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*/) {}
 
240
 
 
241
  //----- image drawing
 
242
  virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
 
243
                             int width, int height, GBool invert, GBool interpolate,
 
244
                             GBool inlineImg);
 
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,
 
256
                                   GBool interpolate,
 
257
                                   Stream *maskStr,
 
258
                                   int maskWidth, int maskHeight,
 
259
                                   GfxImageColorMap *maskColorMap,
 
260
                                   GBool maskInterpolate);
 
261
 
 
262
  //----- grouping operators
 
263
 
 
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);
 
268
  
 
269
  
 
270
 
 
271
#if OPI_SUPPORT
 
272
  //----- OPI functions
 
273
  virtual void opiBegin(GfxState *state, Dict *opiDict);
 
274
  virtual void opiEnd(GfxState *state, Dict *opiDict);
 
275
#endif
 
276
 
 
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*/) {}
 
281
 
 
282
  //----- form XObjects
 
283
  virtual void drawForm(Ref /*id*/) {}
 
284
 
 
285
  //----- PostScript XObjects
 
286
  virtual void psXObject(Stream * /*psStream*/, Stream * /*level1Stream*/) {}
 
287
 
 
288
  //----- Profiling
 
289
  virtual void startProfile();
 
290
  virtual GooHash *getProfileHash() {return profileHash; }
 
291
  virtual GooHash *endProfile();
 
292
 
 
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*/) {}
 
303
 
 
304
  //----- links
 
305
  virtual void processLink(Link * /*link*/, Catalog * /*catalog*/) {}
 
306
 
 
307
#if 1 //~tmp: turn off anti-aliasing temporarily
 
308
  virtual GBool getVectorAntialias() { return gFalse; }
 
309
  virtual void setVectorAntialias(GBool /*vaa*/) {}
 
310
#endif
 
311
 
 
312
private:
 
313
 
 
314
  double defCTM[6];             // default coordinate transform matrix
 
315
  double defICTM[6];            // inverse of default CTM
 
316
  GooHash *profileHash;
 
317
};
 
318
 
 
319
#endif