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

« back to all changes in this revision

Viewing changes to pdftoopvp/oprs/OPVPSplash.h

  • Committer: Package Import Robot
  • Author(s): Till Kamppeter
  • Date: 2012-07-22 18:57:32 UTC
  • mfrom: (1.1.17)
  • Revision ID: package-import@ubuntu.com-20120722185732-26kkte5p1lth3rt5
Tags: 1.0.20-0bzr1
* 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.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//========================================================================
2
 
//
3
 
// OPVPSplash.h
4
 
//
5
 
//========================================================================
6
 
 
7
 
#ifndef OPVPSPLASH_H
8
 
#define OPVPSPLASH_H
9
 
 
10
 
#include <config.h>
11
 
 
12
 
#ifdef USE_GCC_PRAGMAS
13
 
#pragma interface
14
 
#endif
15
 
 
16
 
#include <typeinfo>
17
 
#include "splash/SplashTypes.h"
18
 
#include "splash/SplashPattern.h"
19
 
#include "splash/SplashErrorCodes.h"
20
 
#include "OPVPSplashPath.h"
21
 
#include "OPVPWrapper.h"
22
 
#include "CharTypes.h"
23
 
 
24
 
/* extra error code */
25
 
#define splashErrOPVP 100
26
 
 
27
 
#define OPVP_MAX_CLIPPATH_LENGTH 2000
28
 
#define OPVP_MAX_FILLPATH_LENGTH 4000
29
 
#define OPVP_BITMAPCHAR_THRESHOLD 2000
30
 
#define OPVP_ROP_SRCCOPY 0xCC
31
 
#define OPVP_ROP_S 0xCC
32
 
#define OPVP_ROP_P 0xF0
33
 
#define OPVP_ROP_PSDPxax 0xB8
34
 
#define OPVP_ROP_DSPDxax 0xE2
35
 
 
36
 
class SplashBitmap;
37
 
class SplashGlyphBitmap;
38
 
class OPVPSplashState;
39
 
class SplashPattern;
40
 
class SplashScreen;
41
 
class OPVPSplashPath;
42
 
class OPVPSplashXPath;
43
 
class OPVPSplashClip;
44
 
class SplashFont;
45
 
 
46
 
class OPVPClipPath {
47
 
public:
48
 
  OPVPClipPath(OPVPSplashPath *pathA, GBool eoA);
49
 
  void push();
50
 
  static OPVPClipPath *pop();
51
 
  ~OPVPClipPath() { delete path; }
52
 
  OPVPSplashPath *getPath() { return path; }
53
 
  GBool getEo() { return eo; }
54
 
  GBool getSaved() { return saved; }
55
 
private:
56
 
  OPVPClipPath *copy();
57
 
  OPVPClipPath *next;
58
 
  OPVPSplashPath *path;
59
 
  GBool eo;
60
 
  GBool saved;
61
 
  static OPVPClipPath *stackTop;
62
 
};
63
 
 
64
 
//------------------------------------------------------------------------
65
 
// Splash
66
 
//------------------------------------------------------------------------
67
 
 
68
 
class OPVPSplash {
69
 
public:
70
 
 
71
 
  // Create a new rasterizer object.
72
 
  OPVPSplash(OPVPWrapper *opvpA,
73
 
    int nOptions, const char *optionKeys[], const char *optionVals[]);
74
 
 
75
 
  virtual ~OPVPSplash();
76
 
 
77
 
  //----- state read
78
 
 
79
 
  SplashPattern *getStrokePattern();
80
 
  SplashPattern *getFillPattern();
81
 
  SplashScreen *getScreen();
82
 
  SplashCoord getLineWidth();
83
 
  int getLineCap();
84
 
  int getLineJoin();
85
 
  SplashCoord getMiterLimit();
86
 
  SplashCoord getFlatness();
87
 
  SplashCoord *getLineDash();
88
 
  int getLineDashLength();
89
 
  SplashCoord getLineDashPhase();
90
 
  OPVPSplashClip *getClip();
91
 
 
92
 
  //----- state write
93
 
 
94
 
  void setStrokePattern(SplashPattern *strokeColor);
95
 
  void setFillPattern(SplashPattern *fillColor);
96
 
  void setScreen(SplashScreen *screen);
97
 
  void setLineWidth(SplashCoord lineWidth);
98
 
  void setLineCap(int lineCap);
99
 
  void setLineJoin(int lineJoin);
100
 
  void setMiterLimit(SplashCoord miterLimit);
101
 
  void setFlatness(SplashCoord flatness);
102
 
  // the <lineDash> array will be copied
103
 
  void setLineDash(SplashCoord *lineDash, int lineDashLength,
104
 
                   SplashCoord lineDashPhase);
105
 
  void clipResetToRect(SplashCoord x0, SplashCoord y0,
106
 
                       SplashCoord x1, SplashCoord y1);
107
 
  SplashError clipToPath(OPVPSplashPath *path, GBool eo);
108
 
 
109
 
  //----- state save/restore
110
 
 
111
 
  void saveState();
112
 
  SplashError restoreState();
113
 
  void restoreAllDriverState();
114
 
 
115
 
  //----- drawing operations
116
 
 
117
 
  // Fill the bitmap with <color>.  This is not subject to clipping.
118
 
  void clear(SplashColor color);
119
 
 
120
 
  // Stroke a path using the current stroke pattern.
121
 
  SplashError stroke(OPVPSplashPath *path);
122
 
 
123
 
  // Fill a path using the current fill pattern.
124
 
  SplashError fill(OPVPSplashPath *path, GBool eo);
125
 
 
126
 
  // Draw a character, using the current fill pattern.
127
 
  SplashError fillChar(SplashCoord x, SplashCoord y, int c,
128
 
    SplashFont *font, Unicode *u, double *fontMat);
129
 
 
130
 
  // Draw a glyph, using the current fill pattern.  This function does
131
 
  // not free any data, i.e., it ignores glyph->freeData.
132
 
  // not used in vector mode
133
 
  void fillGlyph(SplashCoord x, SplashCoord y,
134
 
                        SplashGlyphBitmap *glyph);
135
 
 
136
 
  // Draws an image mask using the fill color.  This will read <w>*<h>
137
 
  // pixels from <src>, in raster order, starting with the top line.
138
 
  // "1" pixels will be drawn with the current fill color; "0" pixels
139
 
  // are transparent.  The matrix:
140
 
  //    [ mat[0] mat[1] 0 ]
141
 
  //    [ mat[2] mat[3] 0 ]
142
 
  //    [ mat[4] mat[5] 1 ]
143
 
  // maps a unit square to the desired destination for the image, in
144
 
  // PostScript style:
145
 
  //    [x' y' 1] = [x y 1] * mat
146
 
  // Note that the Splash y axis points downward, and the image source
147
 
  // is assumed to produce pixels in raster order, starting from the
148
 
  // top line.
149
 
  SplashError fillImageMask(SplashImageMaskSource src, void *srcData,
150
 
                            int w, int h, SplashCoord *mat, GBool glyphMode);
151
 
 
152
 
  // Draw an image.  This will read <w>*<h> pixels from <src>, in
153
 
  // raster order, starting with the top line.  These pixels are
154
 
  // assumed to be in the source mode, <srcMode>.  The following
155
 
  // combinations of source and target modes are supported:
156
 
  //    source       target
157
 
  //    ------       ------
158
 
  //    Mono1        Mono1
159
 
  //    Mono8        Mono1   -- with dithering
160
 
  //    Mono8        Mono8
161
 
  //    RGB8         RGB8
162
 
  //    BGR8packed   BGR8Packed
163
 
  // The matrix behaves as for fillImageMask.
164
 
  SplashError drawImage(SplashImageSource src, void *srcData,
165
 
                        SplashColorMode srcMode, GBool srcAlpha,
166
 
                        int w, int h, SplashCoord *mat);
167
 
 
168
 
  //~ drawMaskedImage
169
 
 
170
 
  //----- misc
171
 
 
172
 
  // Return the associated bitmap.
173
 
  SplashBitmap *getBitmap() { return 0; }
174
 
 
175
 
  // Toggle debug mode on or off.
176
 
  void setDebugMode(GBool debugModeA) { debugMode = debugModeA; }
177
 
 
178
 
  void setColorMode(int colorModeA);
179
 
  void setStateBypass(GBool bypass) {stateBypass = bypass;}
180
 
  void endPage();
181
 
  SplashCoord *getMatrix();
182
 
  void drawSpan(int x0, int x1, int y, GBool noClip);
183
 
#ifdef OLD_DRAW_IMAGE
184
 
  void drawPixel(int x, int y, SplashColor *color, GBool noClip);
185
 
#endif
186
 
  void drawPixel(int x, int y, GBool noClip);
187
 
  void arcToCurve(SplashCoord x0, SplashCoord y0,
188
 
    SplashCoord x3, SplashCoord y3,
189
 
    SplashCoord cx, SplashCoord cy, SplashCoord *rx1, SplashCoord *ry1,
190
 
    SplashCoord *rx2, SplashCoord *ry2);
191
 
 
192
 
private:
193
 
  void makeBrush(SplashPattern *pattern, opvp_brush_t *brush);
194
 
  SplashError doClipPath(OPVPSplashPath *path, GBool eo,
195
 
     OPVPClipPath *prevClip);
196
 
  opvp_cspace_t getOPVPColorSpace();
197
 
  GBool equalPattern(SplashPattern *pt1, SplashPattern *pt2);
198
 
  SplashError makeRectanglePath(SplashCoord x0, SplashCoord y0,
199
 
    SplashCoord x1, SplashCoord y1, OPVPSplashPath **p);
200
 
  SplashError drawImageFastWithCTM(SplashImageSource src, void *srcData,
201
 
                              int w, int h, int tx, int ty,
202
 
                              SplashCoord *mat);
203
 
  SplashError drawImageNotShear(SplashImageSource src,
204
 
                              void *srcData,
205
 
                              int w, int h,
206
 
                              int tx, int ty,
207
 
                              int scaledWidth, int scaledHeight,
208
 
                              int xSign, int ySign, GBool rot);
209
 
  SplashError fillImageMaskFastWithCTM(SplashImageMaskSource src,
210
 
       void *srcData, int w, int h, int tx, int ty,SplashCoord *mat);
211
 
  SplashError strokeByMyself(OPVPSplashPath *path);
212
 
  SplashError fillByMyself(OPVPSplashPath *path, GBool eo);
213
 
  OPVPSplashXPath *makeDashedPath(OPVPSplashXPath *xPath);
214
 
  void transform(SplashCoord *matrix, SplashCoord xi, SplashCoord yi,
215
 
           SplashCoord *xo, SplashCoord *yo);
216
 
 
217
 
  const char *getOption(const char *key, int nOptions, const char *optionKeys[],
218
 
    const char *optionVals[]);
219
 
 
220
 
  OPVPWrapper *opvp;
221
 
  int printerContext;
222
 
 
223
 
  OPVPSplashState *state;
224
 
  GBool debugMode;
225
 
  int colorMode;
226
 
  GBool stateBypass;
227
 
  OPVPClipPath *clipPath;
228
 
 
229
 
  GBool oldLipsDriver;
230
 
  GBool clipPathNotSaved;
231
 
  GBool noShearImage;
232
 
  GBool noLineStyle;
233
 
  GBool noClipPath;
234
 
  GBool noMiterLimit;
235
 
  GBool ignoreMiterLimit;
236
 
  GBool savedNoClipPath;
237
 
  GBool noImageMask;
238
 
  int bitmapCharThreshold;
239
 
  int maxClipPathLength;
240
 
  int maxFillPathLength;
241
 
  int saveDriverStateCount;
242
 
};
243
 
 
244
 
#endif