new parameter addspacechars
[swftools.git] / lib / pdf / FullBitmapOutputDev.h
1 /* FullBitmapOutputDev.cc
2    Output device which creates a bitmap.
3
4    This file is part of swftools.
5
6    Swftools is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10
11    Swftools is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with swftools; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
19
20 #ifndef __FullBitmapOutputDev_h__
21 #define __FullBitmapOutputDev_h__
22
23 #include "../gfxdevice.h"
24 #include "../gfxsource.h"
25 #include "../gfxtools.h"
26
27 #include "config.h"
28 #include "GFXOutputDev.h"
29 #include "InfoOutputDev.h"
30 #include "PDFDoc.h"
31 #include "CommonOutputDev.h"
32
33 #define STATE_PARALLEL 0
34 #define STATE_TEXT_IS_ABOVE 1
35 #define STATE_BITMAP_IS_ABOVE 2
36
37 class FullBitmapOutputDev: public CommonOutputDev {
38 public:
39     FullBitmapOutputDev(InfoOutputDev*info, PDFDoc*doc);
40     virtual ~FullBitmapOutputDev();
41    
42     // CommonOutputDev:
43     virtual void setDevice(gfxdevice_t*dev);
44     virtual void setMove(int x,int y);
45     virtual void setClip(int x1,int y1,int x2,int y2);
46     virtual void setParameter(const char*key, const char*value);
47     virtual void setPageMap(int*pagemap, int pagemap_len);
48
49     // OutputDev:
50     virtual GBool upsideDown();
51     virtual GBool useDrawChar();
52     virtual GBool useTilingPatternFill();
53     virtual GBool useShadedFills();
54     virtual GBool useDrawForm();
55     virtual GBool interpretType3Chars();
56     virtual GBool needNonText();
57     virtual void setDefaultCTM(double *ctm);
58 /*    virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
59                                int rotate, GBool useMediaBox, GBool crop,
60                                int sliceX, int sliceY, int sliceW, int sliceH,
61                                GBool printing, Catalog *catalog,
62                                GBool (*abortCheckCbk)(void *data) = NULL,
63                                void *abortCheckCbkData = NULL);*/
64
65     virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2);
66     virtual void endPage();
67
68     virtual void saveState(GfxState *state);
69     virtual void restoreState(GfxState *state);
70
71     virtual void updateAll(GfxState *state);
72     virtual void updateCTM(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32);
73     virtual void updateLineDash(GfxState *state);
74     virtual void updateFlatness(GfxState *state);
75     virtual void updateLineJoin(GfxState *state);
76     virtual void updateLineCap(GfxState *state);
77     virtual void updateMiterLimit(GfxState *state);
78     virtual void updateLineWidth(GfxState *state);
79     virtual void updateStrokeAdjust(GfxState *state);
80     virtual void updateFillColorSpace(GfxState *state);
81     virtual void updateStrokeColorSpace(GfxState *state);
82     virtual void updateFillColor(GfxState *state);
83     virtual void updateStrokeColor(GfxState *state);
84     virtual void updateBlendMode(GfxState *state);
85     virtual void updateFillOpacity(GfxState *state);
86     virtual void updateStrokeOpacity(GfxState *state);
87     virtual void updateFillOverprint(GfxState *state);
88     virtual void updateStrokeOverprint(GfxState *state);
89     virtual void updateTransfer(GfxState *state);
90     virtual void updateFont(GfxState *state);
91     virtual void updateTextMat(GfxState *state);
92     virtual void updateCharSpace(GfxState *state);
93     virtual void updateRender(GfxState *state);
94     virtual void updateRise(GfxState *state);
95     virtual void updateWordSpace(GfxState *state);
96     virtual void updateHorizScaling(GfxState *state);
97     virtual void updateTextPos(GfxState *state);
98     virtual void updateTextShift(GfxState *state, double shift);
99
100     virtual void stroke(GfxState *state);
101     virtual void fill(GfxState *state);
102     virtual void eoFill(GfxState *state);
103 #if (xpdfMajorVersion < 3) || (xpdfMinorVersion < 2) || (xpdfUpdateVersion < 7)
104     virtual void tilingPatternFill(GfxState *state, Object *str,
105                                int paintType, Dict *resDict,
106                                double *mat, double *bbox,
107                                int x0, int y0, int x1, int y1,
108                                double xStep, double yStep);
109 #else
110     virtual void tilingPatternFill(GfxState *state, Gfx *gfx, Object *str,
111                                int paintType, Dict *resDict,
112                                double *mat, double *bbox,
113                                int x0, int y0, int x1, int y1,
114                                double xStep, double yStep);
115 #endif
116
117     virtual GBool functionShadedFill(GfxState *state,
118                                      GfxFunctionShading *shading);
119     virtual GBool axialShadedFill(GfxState *state, GfxAxialShading *shading);
120     virtual GBool radialShadedFill(GfxState *state, GfxRadialShading *shading);
121
122     virtual void clip(GfxState *state);
123     virtual void eoClip(GfxState *state);
124     virtual void clipToStrokePath(GfxState *state);
125
126     virtual void beginStringOp(GfxState *state);
127     virtual void endStringOp(GfxState *state);
128     virtual void beginString(GfxState *state, GString *s);
129     virtual void endString(GfxState *state);
130     virtual void drawChar(GfxState *state, double x, double y,
131                           double dx, double dy,
132                           double originX, double originY,
133                           CharCode code, int nBytes, Unicode *u, int uLen);
134     virtual void drawString(GfxState *state, GString *s);
135     virtual GBool beginType3Char(GfxState *state, double x, double y,
136                                  double dx, double dy,
137                                  CharCode code, Unicode *u, int uLen);
138     virtual void endType3Char(GfxState *state);
139     virtual void endTextObject(GfxState *state);
140
141     virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
142                                int width, int height, GBool invert,
143                                GBool inlineImg);
144     virtual void drawImage(GfxState *state, Object *ref, Stream *str,
145                            int width, int height, GfxImageColorMap *colorMap,
146                            int *maskColors, GBool inlineImg);
147     virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
148                                  int width, int height,
149                                  GfxImageColorMap *colorMap,
150                                  Stream *maskStr, int maskWidth, int maskHeight,
151                                  GBool maskInvert);
152     virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
153                                      int width, int height,
154                                      GfxImageColorMap *colorMap,
155                                      Stream *maskStr,
156                                      int maskWidth, int maskHeight,
157                                      GfxImageColorMap *maskColorMap);
158
159     virtual void type3D0(GfxState *state, double wx, double wy);
160     virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury);
161
162     virtual void drawForm(Ref id);
163
164     virtual void beginTransparencyGroup(GfxState *state, double *bbox,
165                                         GfxColorSpace *blendingColorSpace,
166                                         GBool isolated, GBool knockout,
167                                         GBool forSoftMask);
168     virtual void endTransparencyGroup(GfxState *state);
169     virtual void paintTransparencyGroup(GfxState *state, double *bbox);
170     virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *backdropColor);
171     virtual void clearSoftMask(GfxState *state);
172
173     virtual void processLink(Link *link, Catalog *catalog);
174   
175     virtual void setVectorAntialias(GBool vaa);
176     virtual GBool getVectorAntialias();
177
178     
179 private:
180     void flushBitmap();
181     char config_extrafontdata;
182     PDFDoc*doc;
183     XRef*xref;
184     SplashOutputDev*rgbdev;
185
186     GFXOutputDev*gfxdev;
187     gfxdevice_t*dev;
188
189     int movex, movey;
190     int width, height;
191
192     int user_movex, user_movey;
193     int user_clipx1, user_clipy1;
194     int user_clipx2, user_clipy2;
195 };
196
197 #endif
198
199
200