2 Output device which creates a bitmap.
4 This file is part of swftools.
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.
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.
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 */
20 #ifndef __BitmapOutputDev_h__
21 #define __BitmapOutputDev_h__
23 #include "../gfxdevice.h"
24 #include "../gfxsource.h"
25 #include "../gfxtools.h"
27 #include "../../config.h"
28 #include "GFXOutputDev.h"
29 #include "InfoOutputDev.h"
31 #include "CommonOutputDev.h"
32 #include "popplercompat.h"
37 SplashBitmap*clipbitmap;
42 #define STATE_PARALLEL 0
43 #define STATE_TEXT_IS_ABOVE 1
44 #define STATE_BITMAP_IS_ABOVE 2
46 class BitmapOutputDev: public CommonOutputDev {
48 BitmapOutputDev(InfoOutputDev*info, PDFDoc*doc);
49 virtual ~BitmapOutputDev();
51 virtual void dbg_newdata(char*newdata);
54 virtual void setDevice(gfxdevice_t*dev);
55 virtual void setMove(int x,int y);
56 virtual void setClip(int x1,int y1,int x2,int y2);
57 virtual void setParameter(const char*key, const char*value);
58 virtual void setPageMap(int*page2page, int pagemap_size);
61 virtual GBool upsideDown();
62 virtual GBool useDrawChar();
63 virtual GBool useTilingPatternFill();
64 virtual GBool useShadedFills();
65 virtual GBool useDrawForm();
66 virtual GBool interpretType3Chars();
67 virtual GBool needNonText();
68 virtual void setDefaultCTM(double *ctm);
69 virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
70 int rotate, GBool useMediaBox, GBool crop,
71 int sliceX, int sliceY, int sliceW, int sliceH,
72 GBool printing, Catalog *catalog,
73 GBool (*abortCheckCbk)(void *data) = NULL,
74 void *abortCheckCbkData = NULL);
76 virtual void startPage(int pageNum, GfxState *state);
77 virtual void endPage();
78 virtual void finishPage();
80 virtual void saveState(GfxState *state);
81 virtual void restoreState(GfxState *state);
83 virtual void updateAll(GfxState *state);
84 virtual void updateCTM(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32);
85 virtual void updateLineDash(GfxState *state);
86 virtual void updateFlatness(GfxState *state);
87 virtual void updateLineJoin(GfxState *state);
88 virtual void updateLineCap(GfxState *state);
89 virtual void updateMiterLimit(GfxState *state);
90 virtual void updateLineWidth(GfxState *state);
91 virtual void updateStrokeAdjust(GfxState *state);
92 virtual void updateFillColorSpace(GfxState *state);
93 virtual void updateStrokeColorSpace(GfxState *state);
94 virtual void updateFillColor(GfxState *state);
95 virtual void updateStrokeColor(GfxState *state);
96 virtual void updateBlendMode(GfxState *state);
97 virtual void updateFillOpacity(GfxState *state);
98 virtual void updateStrokeOpacity(GfxState *state);
99 virtual void updateFillOverprint(GfxState *state);
100 virtual void updateStrokeOverprint(GfxState *state);
101 virtual void updateTransfer(GfxState *state);
102 virtual void updateFont(GfxState *state);
103 virtual void updateTextMat(GfxState *state);
104 virtual void updateCharSpace(GfxState *state);
105 virtual void updateRender(GfxState *state);
106 virtual void updateRise(GfxState *state);
107 virtual void updateWordSpace(GfxState *state);
108 virtual void updateHorizScaling(GfxState *state);
109 virtual void updateTextPos(GfxState *state);
110 virtual void updateTextShift(GfxState *state, double shift);
112 virtual void stroke(GfxState *state);
113 virtual void fill(GfxState *state);
114 virtual void eoFill(GfxState *state);
115 virtual POPPLER_TILING_PATERN_RETURN tilingPatternFill(
116 GfxState *state, POPPLER_TILING_PATERN_GFX Object *str,
117 int paintType, Dict *resDict,
118 double *mat, double *bbox,
119 int x0, int y0, int x1, int y1,
120 double xStep, double yStep);
122 virtual GBool functionShadedFill(GfxState *state,
123 GfxFunctionShading *shading);
124 virtual GBool axialShadedFill(GfxState *state, GfxAxialShading *shading);
125 virtual GBool radialShadedFill(GfxState *state, GfxRadialShading *shading);
127 virtual void clip(GfxState *state);
128 virtual void eoClip(GfxState *state);
129 virtual void clipToStrokePath(GfxState *state);
131 virtual void beginStringOp(GfxState *state);
132 virtual void endStringOp(GfxState *state);
133 virtual void beginString(GfxState *state, GString *s);
134 virtual void endString(GfxState *state);
135 virtual void drawChar(GfxState *state, double x, double y,
136 double dx, double dy,
137 double originX, double originY,
138 CharCode code, int nBytes, Unicode *u, int uLen);
139 virtual void drawString(GfxState *state, GString *s);
140 virtual GBool beginType3Char(GfxState *state, double x, double y,
141 double dx, double dy,
142 CharCode code, Unicode *u, int uLen);
143 virtual void endType3Char(GfxState *state);
144 virtual void endTextObject(GfxState *state);
146 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
147 int width, int height, GBool invert,
149 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
150 int width, int height, GfxImageColorMap *colorMap,
151 int *maskColors, GBool inlineImg);
152 virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
153 int width, int height,
154 GfxImageColorMap *colorMap,
155 Stream *maskStr, int maskWidth, int maskHeight,
157 virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
158 int width, int height,
159 GfxImageColorMap *colorMap,
161 int maskWidth, int maskHeight,
162 GfxImageColorMap *maskColorMap);
164 virtual void type3D0(GfxState *state, double wx, double wy);
165 virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury);
167 virtual void drawForm(Ref id);
169 virtual void beginTransparencyGroup(GfxState *state, double *bbox,
170 GfxColorSpace *blendingColorSpace,
171 GBool isolated, GBool knockout,
173 virtual void endTransparencyGroup(GfxState *state);
174 virtual void paintTransparencyGroup(GfxState *state, double *bbox);
175 virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *backdropColor);
176 virtual void clearSoftMask(GfxState *state);
178 virtual void processLink(Link *link, Catalog *catalog);
180 virtual void setVectorAntialias(GBool vaa);
181 virtual GBool getVectorAntialias();
185 void flushEverything();
187 void clearBoolPolyDev();
188 void clearBoolTextDev();
191 GBool checkNewText(int x1, int y1, int x2, int y2);
192 GBool checkNewBitmap(int x1, int y1, int x2, int y2);
193 GBool clip0and1differ(int x1,int y1,int x2,int y2);
194 GBool intersection(SplashBitmap*boolpoly, SplashBitmap*booltext, int x1, int y1, int x2, int y2);
196 virtual gfxbbox_t getImageBBox(GfxState*state);
197 virtual gfxbbox_t getBBox(GfxState*state);
199 char config_extrafontdata;
200 char config_optimizeplaincolorfills;
209 SplashOutputDev*rgbdev;
210 SplashOutputDev*clip0dev;
211 SplashOutputDev*clip1dev;
212 SplashOutputDev*boolpolydev;
213 SplashOutputDev*booltextdev;
215 SplashBitmap*rgbbitmap;
216 SplashBitmap*clip0bitmap;
217 SplashBitmap*clip1bitmap;
218 SplashBitmap*boolpolybitmap;
219 SplashBitmap*stalepolybitmap;
220 SplashBitmap*booltextbitmap;
221 SplashBitmap*staletextbitmap;
223 gfxdevice_t* gfxoutput;
231 int user_movex, user_movey;
232 int user_clipx1, user_clipy1;
233 int user_clipx2, user_clipy2;
235 //ClipState*clipstates;