~ubuntu-branches/ubuntu/dapper/poppler/dapper-security

« back to all changes in this revision

Viewing changes to utils/SplashOutputDev.h

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2005-12-30 11:34:07 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20051230113407-8grizsk0ar874uoi
Tags: 0.4.3-1
* New upstream release.
* New maintainer (Closes: #344738)
* CVE-2005-3191 and CAN-2005-2097 fixes merged upstream.
* Fixed some rendering bugs and disabled Cairo output
  (Closes: #314556, #322964, #328211)
* Acknowledge NMU (Closes: #342288)
* Add 001-selection-crash-bug.patch (Closes: #330544)
* Add poppler-utils (merge patch from Ubuntu)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//========================================================================
2
 
//
3
 
// SplashOutputDev.h
4
 
//
5
 
// Copyright 2003 Glyph & Cog, LLC
6
 
//
7
 
//========================================================================
8
 
 
9
 
#ifndef SPLASHOUTPUTDEV_H
10
 
#define SPLASHOUTPUTDEV_H
11
 
 
12
 
#include <poppler-config.h>
13
 
 
14
 
#ifdef USE_GCC_PRAGMAS
15
 
#pragma interface
16
 
#endif
17
 
 
18
 
#include "goo/gtypes.h"
19
 
#include "splash/SplashTypes.h"
20
 
#include "config.h"
21
 
#include "OutputDev.h"
22
 
 
23
 
class GfxState;
24
 
class GfxPath;
25
 
class Gfx8BitFont;
26
 
class SplashBitmap;
27
 
class Splash;
28
 
class SplashPath;
29
 
class SplashPattern;
30
 
class SplashFontEngine;
31
 
class SplashFont;
32
 
class T3FontCache;
33
 
struct T3FontCacheTag;
34
 
struct T3GlyphStack;
35
 
struct GfxRGB;
36
 
 
37
 
//------------------------------------------------------------------------
38
 
 
39
 
// number of Type 3 fonts to cache
40
 
#define splashOutT3FontCacheSize 8
41
 
 
42
 
//------------------------------------------------------------------------
43
 
// SplashOutputDev
44
 
//------------------------------------------------------------------------
45
 
 
46
 
class SplashOutputDev: public OutputDev {
47
 
public:
48
 
 
49
 
  // Constructor.
50
 
  SplashOutputDev(SplashColorMode colorModeA, GBool reverseVideoA,
51
 
                  SplashColor paperColorA);
52
 
 
53
 
  // Destructor.
54
 
  virtual ~SplashOutputDev();
55
 
 
56
 
  //----- get info about output device
57
 
 
58
 
  // Does this device use upside-down coordinates?
59
 
  // (Upside-down means (0,0) is the top left corner of the page.)
60
 
  virtual GBool upsideDown() { return gTrue; }
61
 
 
62
 
  // Does this device use drawChar() or drawString()?
63
 
  virtual GBool useDrawChar() { return gTrue; }
64
 
 
65
 
  // Does this device use beginType3Char/endType3Char?  Otherwise,
66
 
  // text in Type 3 fonts will be drawn with drawChar/drawString.
67
 
  virtual GBool interpretType3Chars() { return gTrue; }
68
 
 
69
 
  //----- initialization and control
70
 
 
71
 
  // Start a page.
72
 
  virtual void startPage(int pageNum, GfxState *state);
73
 
 
74
 
  // End a page.
75
 
  virtual void endPage();
76
 
 
77
 
  //----- link borders
78
 
  virtual void drawLink(Link *link, Catalog *catalog);
79
 
 
80
 
  //----- save/restore graphics state
81
 
  virtual void saveState(GfxState *state);
82
 
  virtual void restoreState(GfxState *state);
83
 
 
84
 
  //----- update graphics state
85
 
  virtual void updateAll(GfxState *state);
86
 
  virtual void updateCTM(GfxState *state, double m11, double m12,
87
 
                         double m21, double m22, double m31, double m32);
88
 
  virtual void updateLineDash(GfxState *state);
89
 
  virtual void updateFlatness(GfxState *state);
90
 
  virtual void updateLineJoin(GfxState *state);
91
 
  virtual void updateLineCap(GfxState *state);
92
 
  virtual void updateMiterLimit(GfxState *state);
93
 
  virtual void updateLineWidth(GfxState *state);
94
 
  virtual void updateFillColor(GfxState *state);
95
 
  virtual void updateStrokeColor(GfxState *state);
96
 
 
97
 
  //----- update text state
98
 
  virtual void updateFont(GfxState *state);
99
 
 
100
 
  //----- path painting
101
 
  virtual void stroke(GfxState *state);
102
 
  virtual void fill(GfxState *state);
103
 
  virtual void eoFill(GfxState *state);
104
 
 
105
 
  //----- path clipping
106
 
  virtual void clip(GfxState *state);
107
 
  virtual void eoClip(GfxState *state);
108
 
 
109
 
  //----- text drawing
110
 
  virtual void drawChar(GfxState *state, double x, double y,
111
 
                        double dx, double dy,
112
 
                        double originX, double originY,
113
 
                        CharCode code, Unicode *u, int uLen);
114
 
  virtual GBool beginType3Char(GfxState *state, double x, double y,
115
 
                               double dx, double dy,
116
 
                               CharCode code, Unicode *u, int uLen);
117
 
  virtual void endType3Char(GfxState *state);
118
 
  virtual void endTextObject(GfxState *state);
119
 
 
120
 
  //----- image drawing
121
 
  virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
122
 
                             int width, int height, GBool invert,
123
 
                             GBool inlineImg);
124
 
  virtual void drawImage(GfxState *state, Object *ref, Stream *str,
125
 
                         int width, int height, GfxImageColorMap *colorMap,
126
 
                         int *maskColors, GBool inlineImg);
127
 
 
128
 
  //----- Type 3 font operators
129
 
  virtual void type3D0(GfxState *state, double wx, double wy);
130
 
  virtual void type3D1(GfxState *state, double wx, double wy,
131
 
                       double llx, double lly, double urx, double ury);
132
 
 
133
 
  //----- special access
134
 
 
135
 
  // Called to indicate that a new PDF document has been loaded.
136
 
  void startDoc(XRef *xrefA);
137
 
 
138
 
  GBool isReverseVideo() { return reverseVideo; }
139
 
 
140
 
  // Get the bitmap and its size.
141
 
  SplashBitmap *getBitmap() { return bitmap; }
142
 
  int getBitmapWidth();
143
 
  int getBitmapHeight();
144
 
 
145
 
  // Get the Splash object.
146
 
  Splash *getSplash() { return splash; }
147
 
 
148
 
  // XOR a rectangular region in the bitmap with <pattern>.  <pattern>
149
 
  // is passed to Splash::setFillPattern, so it should not be used
150
 
  // after calling this function.
151
 
  void xorRectangle(int x0, int y0, int x1, int y1, SplashPattern *pattern);
152
 
 
153
 
  // Set the Splash fill color.
154
 
  void setFillColor(int r, int g, int b);
155
 
 
156
 
  // Get a font object for a Base-14 font, using the Latin-1 encoding.
157
 
  SplashFont *getFont(GooString *name, double *mat);
158
 
 
159
 
  void setUnderlayCbk(void (*cbk)(void *data), void *data)
160
 
    { underlayCbk = cbk; underlayCbkData = data; }
161
 
 
162
 
private:
163
 
 
164
 
  SplashPattern *getColor(double gray, GfxRGB *rgb);
165
 
  SplashPath *convertPath(GfxState *state, GfxPath *path);
166
 
  void drawType3Glyph(T3FontCache *t3Font,
167
 
                      T3FontCacheTag *tag, Guchar *data,
168
 
                      double x, double y);
169
 
  static GBool imageMaskSrc(void *data, SplashMono1 *pixel);
170
 
  static GBool imageSrc(void *data, SplashColor *pixel, Guchar *alpha);
171
 
 
172
 
  SplashColorMode colorMode;
173
 
  GBool reverseVideo;           // reverse video mode
174
 
  SplashColor paperColor;       // paper color
175
 
 
176
 
  XRef *xref;                   // xref table for current document
177
 
 
178
 
  SplashBitmap *bitmap;
179
 
  Splash *splash;
180
 
  SplashFontEngine *fontEngine;
181
 
 
182
 
  T3FontCache *                 // Type 3 font cache
183
 
    t3FontCache[splashOutT3FontCacheSize];
184
 
  int nT3Fonts;                 // number of valid entries in t3FontCache
185
 
  T3GlyphStack *t3GlyphStack;   // Type 3 glyph context stack
186
 
 
187
 
  SplashFont *font;             // current font
188
 
  GBool needFontUpdate;         // set when the font needs to be updated
189
 
  SplashPath *textClipPath;     // clipping path built with text object
190
 
 
191
 
  void (*underlayCbk)(void *data);
192
 
  void *underlayCbkData;
193
 
};
194
 
 
195
 
#endif