~ubuntu-branches/ubuntu/raring/cups-filters/raring-proposed

« back to all changes in this revision

Viewing changes to filter/pdftoopvp/oprs/OPRS.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
// OPRS.h
 
4
//
 
5
//========================================================================
 
6
 
 
7
#ifndef OPRS_H
 
8
#define OPRS_H
 
9
 
 
10
#include <config.h>
 
11
 
 
12
#ifdef USE_GCC_PRAGMAS
 
13
#pragma interface
 
14
#endif
 
15
 
 
16
#include "splash/SplashTypes.h"
 
17
#include "opvp_common.h"
 
18
#include "splash/Splash.h"
 
19
#include "OPVPSplash.h"
 
20
#include "OPVPWrapper.h"
 
21
 
 
22
#define OPVP_BUFF_SIZE 256
 
23
 
 
24
class SplashBitmap;
 
25
class SplashGlyphBitmap;
 
26
class SplashState;
 
27
class SplashPattern;
 
28
class SplashScreen;
 
29
class OPVPSplashPath;
 
30
class SplashXPath;
 
31
class OPVPSplashClip;
 
32
class SplashFont;
 
33
 
 
34
//------------------------------------------------------------------------
 
35
// OPRS
 
36
//------------------------------------------------------------------------
 
37
 
 
38
class OPRS {
 
39
public:
 
40
 
 
41
  static void error(const char *msg, ...);
 
42
  OPRS();
 
43
  ~OPRS();
 
44
 
 
45
  int setBitmap(SplashBitmap *bitmapA);
 
46
 
 
47
  //----- state read
 
48
 
 
49
  SplashPattern *getStrokePattern();
 
50
  SplashPattern *getFillPattern();
 
51
  SplashScreen *getScreen();
 
52
  SplashCoord getLineWidth();
 
53
  int getLineCap();
 
54
  int getLineJoin();
 
55
  SplashCoord getMiterLimit();
 
56
  SplashCoord getFlatness();
 
57
  SplashCoord *getLineDash();
 
58
  int getLineDashLength();
 
59
  SplashCoord getLineDashPhase();
 
60
  OPVPSplashClip *getClip();
 
61
 
 
62
  //----- state write
 
63
 
 
64
  void setStrokePattern(SplashPattern *strokeColor);
 
65
  void setFillPattern(SplashPattern *fillColor);
 
66
  void setScreen(SplashScreen *screen);
 
67
  void setLineWidth(SplashCoord lineWidth);
 
68
  void setMiterLimit(SplashCoord miterLimit);
 
69
  void setLineCap(int lineCap);
 
70
  void setLineJoin(int lineJoin);
 
71
  void setFlatness(SplashCoord flatness);
 
72
  // the <lineDash> array will be copied
 
73
  void setLineDash(SplashCoord *lineDash, int lineDashLength,
 
74
                   SplashCoord lineDashPhase);
 
75
  SplashError clipToPath(OPVPSplashPath *path, GBool eo);
 
76
 
 
77
  //----- state save/restore
 
78
 
 
79
  void saveState();
 
80
  SplashError restoreState();
 
81
 
 
82
  void setSoftMask(SplashBitmap *softMaskA);
 
83
 
 
84
  //----- drawing operations
 
85
 
 
86
  // Fill the bitmap with <color>.  This is not subject to clipping.
 
87
  void clear(SplashColor color);
 
88
 
 
89
  // Stroke a path using the current stroke pattern.
 
90
  SplashError stroke(OPVPSplashPath *path);
 
91
 
 
92
  // Fill a path using the current fill pattern.
 
93
  SplashError fill(OPVPSplashPath *path, GBool eo);
 
94
 
 
95
  // Draw a character, using the current fill pattern.
 
96
  SplashError fillChar(SplashCoord x, SplashCoord y, int c, SplashFont *font,
 
97
    Unicode *u, double *fontMat);
 
98
 
 
99
  // Draw a glyph, using the current fill pattern.  This function does
 
100
  // not free any data, i.e., it ignores glyph->freeData.
 
101
  SplashError fillGlyph(SplashCoord x, SplashCoord y,
 
102
                        SplashGlyphBitmap *glyph);
 
103
 
 
104
  // Draws an image mask using the fill color.  This will read <w>*<h>
 
105
  // pixels from <src>, in raster order, starting with the top line.
 
106
  // "1" pixels will be drawn with the current fill color; "0" pixels
 
107
  // are transparent.  The matrix:
 
108
  //    [ mat[0] mat[1] 0 ]
 
109
  //    [ mat[2] mat[3] 0 ]
 
110
  //    [ mat[4] mat[5] 1 ]
 
111
  // maps a unit square to the desired destination for the image, in
 
112
  // PostScript style:
 
113
  //    [x' y' 1] = [x y 1] * mat
 
114
  // Note that the Splash y axis points downward, and the image source
 
115
  // is assumed to produce pixels in raster order, starting from the
 
116
  // top line.
 
117
  SplashError fillImageMask(SplashImageMaskSource src, void *srcData,
 
118
                            int w, int h, SplashCoord *mat, GBool glyphMode);
 
119
 
 
120
  // Draw an image.  This will read <w>*<h> pixels from <src>, in
 
121
  // raster order, starting with the top line.  These pixels are
 
122
  // assumed to be in the source mode, <srcMode>.  The following
 
123
  // combinations of source and target modes are supported:
 
124
  //    source       target
 
125
  //    ------       ------
 
126
  //    Mono1        Mono1
 
127
  //    Mono8        Mono1   -- with dithering
 
128
  //    Mono8        Mono8
 
129
  //    RGB8         RGB8
 
130
  //    BGR8packed   BGR8Packed
 
131
  // The matrix behaves as for fillImageMask.
 
132
  SplashError drawImage(SplashImageSource src, void *srcData,
 
133
                        SplashColorMode srcMode, GBool srcAlpha,
 
134
                        int w, int h, SplashCoord *mat);
 
135
 
 
136
  //~ drawMaskedImage
 
137
 
 
138
  //----- misc
 
139
 
 
140
  // Return the associated bitmap.
 
141
  SplashBitmap *getBitmap();
 
142
 
 
143
  // Toggle debug mode on or off.
 
144
  void setDebugMode(GBool debugModeA);
 
145
 
 
146
  int init(const char *driverName, int outputFD,
 
147
      const char *printerModel, int nOptions,
 
148
      const char *optionKeys[], const char *optionVals[]);
 
149
  void initGS(int colorMode, int w, int h, SplashColor paperColor);
 
150
  int setColorMode(int colorModeA, GBool colorProfile);
 
151
  int unloadVectorDriver();
 
152
 
 
153
  int OPVPStartJob(char *jobInfo);
 
154
  int OPVPEndJob();
 
155
  int OPVPStartDoc(char *docInfo);
 
156
  int OPVPEndDoc();
 
157
  int OPVPStartPage(char *pageInfo, int rasterWidth);
 
158
  int OPVPEndPage();
 
159
  int outSlice();
 
160
  Splash *getSplash() { return splash; }
 
161
  int getRasterMode() { return rasterMode; }
 
162
  void endPage();
 
163
  SplashCoord *getMatrix();
 
164
 
 
165
private:
 
166
  int rasterMode;
 
167
  OPVPSplash *opvpSplash;
 
168
  Splash *splash;
 
169
  OPVPWrapper *opvp;
 
170
  int getRasterSize(SplashBitmap *bitmap);
 
171
 
 
172
  typedef unsigned char *(*GetScanLineDataFunT)(unsigned char *dst,
 
173
    unsigned char *bitmap, int rasterWidth);
 
174
 
 
175
  static unsigned char *getScanLineDataMono1(unsigned char *dst,
 
176
    unsigned char *bitmap, int rasterWidth);
 
177
  static unsigned char *getScanLineDataMono8(unsigned char *dst,
 
178
    unsigned char *bitmap, int rasterWidth);
 
179
  static unsigned char *getScanLineDataRGB8(unsigned char *dst,
 
180
    unsigned char *bitmap, int rasterWidth);
 
181
  static unsigned char *getScanLineDataBGR8Packed(unsigned char *dst,
 
182
    unsigned char *bitmap, int rasterWidth);
 
183
 
 
184
  GetScanLineDataFunT getGetScanLineDataFun(SplashBitmap *bitmap);
 
185
  GBool checkAll1(unsigned char *bp, int n, int width, int mode);
 
186
};
 
187
 
 
188
#endif