~ubuntu-branches/debian/experimental/cups-filters/experimental

« back to all changes in this revision

Viewing changes to filter/pdftoopvp/OPVPOutputDev.h

  • Committer: Package Import Robot
  • Author(s): Till Kamppeter
  • Date: 2012-07-28 11:54:32 UTC
  • mfrom: (1.1.17) (22 sid)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: package-import@ubuntu.com-20120728115432-p5fgn9hv6du22cqa
Tags: 1.0.20-1
* New upstream release
   - pdftops: Added another workaround for Kyocera printers: Some
     models get very slow on images which request interpolation,
     so now we remove the image interpolation requests by additional
     PostScript code only inserted for Kyocera printers (LP: #1026974).
   - Made the Poppler-based filters pdftopdf and pdftoopvp build with
     both Poppler 0.18.x and 0.20.x (Upstream bug #1055).
   - Fixes according to Coverity scan results (Upstream bug #1054).
   - Switched build system to autotools. This especially fixes several
     build problems in Gentoo. Also build-tested with CUPS 1.6.0b1.
   - Fixes for compatibility with clang/gcc-4.7.
   - textonly: Filter did not work as a pipe with copies=1 (Upstream bug
     #1032).
   - texttopdf: Avoid trimming the results of FcFontSort(), as this may
     miss some reasonable candidates under certain circumstances. BTW,
     fix passing a non-pointer as a pointer to "result" (Closes: #670055).
   - Corrected documentation. The option for the maximum image rendering
     resolution in pdftops is "pdftops-max-image-resolution", not
     "pdftops-max-image-resolution-default".
* debian/patches/fcfontsort-no-trim.patch: Removed, fixed upstream.
* debian/rules: Updated options for ./configure and make for the new autotools
  build system.
* debian/watch: Switched to bz2 upstream packages.
* debian/rules, debian/copyright, debian/cups-filters.docs: Updated for
  renamed documentation files.
* debian/control, debian/libfontembed1.install,
  debian/libfontembed-dev.install: Added new binary packages for libfontembed.
* debian/copyright: Updated for recent file additions, and rearrangement of
  directories.
* debian/control: Added missing build dependency on libpoppler-cpp-dev.
* debian/copyright: Corrections (Closes: #682752).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//========================================================================
 
2
//
 
3
// OPVPOutputDev.h
 
4
//
 
5
// Copyright 2005 AXE,Inc.
 
6
//
 
7
//========================================================================
 
8
 
 
9
#ifndef OPVPOUTPUTDEV_H
 
10
#define OPVPOUTPUTDEV_H
 
11
 
 
12
#include <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
#include "GfxState.h"
 
23
#include "GfxFont.h"
 
24
 
 
25
class GfxState;
 
26
class GfxPath;
 
27
class Gfx8BitFont;
 
28
class SplashBitmap;
 
29
class OPRS;
 
30
class OPVPSplashPath;
 
31
class SplashPattern;
 
32
class SplashFontEngine;
 
33
class SplashFont;
 
34
class T3FontCache;
 
35
struct T3FontCacheTag;
 
36
struct T3GlyphStack;
 
37
struct GfxRGB;
 
38
 
 
39
//------------------------------------------------------------------------
 
40
 
 
41
// number of Type 3 fonts to cache
 
42
#define splashOutT3FontCacheSize 8
 
43
 
 
44
//------------------------------------------------------------------------
 
45
// OPVPOutputDev
 
46
//------------------------------------------------------------------------
 
47
 
 
48
class OPVPOutputDev: public OutputDev {
 
49
public:
 
50
 
 
51
  // Constructor.
 
52
  OPVPOutputDev();
 
53
 
 
54
  // Second Constructor
 
55
  int init(SplashColorMode colorModeA, GBool colorProfile, GBool reverseVideoA,
 
56
                  SplashColor paperColorA,
 
57
                  const char *driverName, int outputFD,
 
58
                  const char *printerModel,
 
59
                  int nOptions,
 
60
                  const char *optionKeys[], const char *optionVals[]);
 
61
 
 
62
  // Destructor.
 
63
  virtual ~OPVPOutputDev();
 
64
 
 
65
  //----- get info about output device
 
66
 
 
67
  // Does this device use upside-down coordinates?
 
68
  // (Upside-down means (0,0) is the top left corner of the page.)
 
69
  virtual GBool upsideDown() { return gTrue; }
 
70
 
 
71
  // Does this device use drawChar() or drawString()?
 
72
  virtual GBool useDrawChar() { return gTrue; }
 
73
 
 
74
  // Does this device use beginType3Char/endType3Char?  Otherwise,
 
75
  // text in Type 3 fonts will be drawn with drawChar/drawString.
 
76
  virtual GBool interpretType3Chars() { return gTrue; }
 
77
 
 
78
  //----- initialization and control
 
79
 
 
80
  // Start a page.
 
81
  virtual void startPage(int pageNum, GfxState *state);
 
82
 
 
83
  // End a page.
 
84
  virtual void endPage();
 
85
 
 
86
  //----- save/restore graphics state
 
87
  virtual void saveState(GfxState *state);
 
88
  virtual void restoreState(GfxState *state);
 
89
 
 
90
  //----- update graphics state
 
91
  virtual void updateAll(GfxState *state);
 
92
  virtual void updateCTM(GfxState *state, double m11, double m12,
 
93
                         double m21, double m22, double m31, double m32);
 
94
  virtual void updateLineDash(GfxState *state);
 
95
  virtual void updateFlatness(GfxState *state);
 
96
  virtual void updateLineJoin(GfxState *state);
 
97
  virtual void updateLineCap(GfxState *state);
 
98
  virtual void updateMiterLimit(GfxState *state);
 
99
  virtual void updateLineWidth(GfxState *state);
 
100
  virtual void updateFillColor(GfxState *state);
 
101
  virtual void updateStrokeColor(GfxState *state);
 
102
 
 
103
  //----- update text state
 
104
  virtual void updateFont(GfxState *state);
 
105
 
 
106
  //----- path painting
 
107
  virtual void stroke(GfxState *state);
 
108
  virtual void fill(GfxState *state);
 
109
  virtual void eoFill(GfxState *state);
 
110
 
 
111
  //----- path clipping
 
112
  virtual void clip(GfxState *state);
 
113
  virtual void eoClip(GfxState *state);
 
114
  virtual void clipToStrokePath(GfxState *state);
 
115
 
 
116
  //----- text drawing
 
117
  virtual void drawChar(GfxState *state, double x, double y,
 
118
                        double dx, double dy,
 
119
                        double originX, double originY,
 
120
                        CharCode code, int nBytes, Unicode *u, int uLen);
 
121
  virtual GBool beginType3Char(GfxState *state, double x, double y,
 
122
                               double dx, double dy,
 
123
                               CharCode code, Unicode *u, int uLen);
 
124
  virtual void endType3Char(GfxState *state);
 
125
  virtual void endTextObject(GfxState *state);
 
126
 
 
127
  //----- image drawing
 
128
  virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
 
129
                             int width, int height, GBool invert,
 
130
                             GBool interpolate,
 
131
                             GBool inlineImg);
 
132
  virtual void drawImage(GfxState *state, Object *ref, Stream *str,
 
133
                         int width, int height, GfxImageColorMap *colorMap,
 
134
                         GBool interpolate,
 
135
                         int *maskColors, GBool inlineImg);
 
136
  virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
 
137
                               int width, int height,
 
138
                               GfxImageColorMap *colorMap,
 
139
                               GBool interpolate,
 
140
                               Stream *maskStr, int maskWidth, int maskHeight,
 
141
                               GBool maskInvert, GBool maskeInterpolate);
 
142
  virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
 
143
                                   int width, int height,
 
144
                                   GfxImageColorMap *colorMap,
 
145
                                   GBool interpolate,
 
146
                                   Stream *maskStr,
 
147
                                   int maskWidth, int maskHeight,
 
148
                                   GfxImageColorMap *maskColorMap,
 
149
                                   GBool maskInterpolate);
 
150
 
 
151
  //----- Type 3 font operators
 
152
  virtual void type3D0(GfxState *state, double wx, double wy);
 
153
  virtual void type3D1(GfxState *state, double wx, double wy,
 
154
                       double llx, double lly, double urx, double ury);
 
155
 
 
156
  //----- special access
 
157
 
 
158
  // Called to indicate that a new PDF document has been loaded.
 
159
  void startDoc(XRef *xrefA);
 
160
 
 
161
  GBool isReverseVideo() { return reverseVideo; }
 
162
 
 
163
  // Get the bitmap and its size.
 
164
  SplashBitmap *getBitmap() { return bitmap; }
 
165
  int getBitmapWidth();
 
166
  int getBitmapHeight();
 
167
 
 
168
  // Get the Splash object.
 
169
  OPRS *getOPRS() { return oprs; }
 
170
 
 
171
  // XOR a rectangular region in the bitmap with <pattern>.  <pattern>
 
172
  // is passed to Splash::setFillPattern, so it should not be used
 
173
  // after calling this function.
 
174
  void xorRectangle(int x0, int y0, int x1, int y1, SplashPattern *pattern);
 
175
 
 
176
  // Set the Splash fill color.
 
177
  void setFillColor(int r, int g, int b);
 
178
 
 
179
  void setUnderlayCbk(void (*cbk)(void *data), void *data)
 
180
    { underlayCbk = cbk; underlayCbkData = data; }
 
181
 
 
182
  int OPVPStartJob(char *jobInfo);
 
183
  int OPVPEndJob();
 
184
  int OPVPStartDoc(char *docInfo);
 
185
  int OPVPEndDoc();
 
186
  int OPVPStartPage(char *pageInfo, int rasterWidth, int rasterHeight);
 
187
  int OPVPEndPage();
 
188
  int outSlice();
 
189
  virtual void psXObject(Stream *psStream, Stream *level1Stream);
 
190
  void setScale(double w, double h, double leftMarginA, double bottomMarginA,
 
191
    int rotateA, int yoffsetA, int sliceHeightA);
 
192
 
 
193
private:
 
194
 
 
195
  SplashPattern *getColor(GfxGray gray, GfxRGB *rgb);
 
196
  OPVPSplashPath *convertPath(GfxState *state, GfxPath *path);
 
197
  void drawType3Glyph(T3FontCache *t3Font,
 
198
                      T3FontCacheTag *tag, Guchar *data,
 
199
                      double x, double y);
 
200
  void patternFillChar(GfxState *state,
 
201
    double x, double y, CharCode code);
 
202
 
 
203
  static GBool imageMaskSrc(void *data, SplashColorPtr line);
 
204
  static GBool imageSrc(void *data, SplashColorPtr line,
 
205
                              Guchar *alphaLine);
 
206
  static GBool alphaImageSrc(void *data, SplashColorPtr line,
 
207
                              Guchar *alphaLine);
 
208
  static GBool maskedImageSrc(void *data, SplashColorPtr line,
 
209
                              Guchar *alphaLine);
 
210
 
 
211
  OPVPSplashPath *bitmapToPath(SplashBitmap *bitmapA, int width, int height);
 
212
  void closeAllSubPath(OPVPSplashPath *path);
 
213
  void patternFillImageMask(GfxState *state,
 
214
    SplashImageMaskSource src, void *srcData, int w, int h, SplashCoord *mat);
 
215
  void doUpdateFont(GfxState *state);
 
216
  void transLineDash(GfxState *state, SplashCoord **adash,
 
217
    int *adashLength, SplashCoord *aphase);
 
218
  void updateSplashLineDash(GfxState *state, Splash *splash);
 
219
 
 
220
  SplashColorMode colorMode;
 
221
  GBool reverseVideo;           // reverse video mode
 
222
  SplashColor paperColor;       // paper color
 
223
 
 
224
  XRef *xref;                   // xref table for current document
 
225
 
 
226
  SplashBitmap *bitmap;
 
227
  OPRS *oprs;
 
228
  SplashFontEngine *fontEngine;
 
229
 
 
230
  T3FontCache *                 // Type 3 font cache
 
231
    t3FontCache[splashOutT3FontCacheSize];
 
232
  int nT3Fonts;                 // number of valid entries in t3FontCache
 
233
  T3GlyphStack *t3GlyphStack;   // Type 3 glyph context stack
 
234
 
 
235
  SplashFont *font;             // current font
 
236
  GBool needFontUpdate;         // set when the font needs to be updated
 
237
  OPVPSplashPath *textClipPath; // clipping path built with text object
 
238
 
 
239
  void (*underlayCbk)(void *data);
 
240
  void *underlayCbkData;
 
241
  double fontMat[4];
 
242
  double scaleWidth, scaleHeight;
 
243
  int paperWidth, paperHeight;
 
244
  double leftMargin, bottomMargin;
 
245
  int rotate;
 
246
  int yoffset;
 
247
  int sliceHeight;
 
248
};
 
249
 
 
250
#endif