1 #ifndef __gfxoutputdev_h__
2 #define __gfxoutputdev_h__
4 #include "../gfxdevice.h"
5 #include "../gfxsource.h"
6 #include "../gfxtools.h"
9 #include "InfoOutputDev.h"
11 #include "GlobalParams.h"
12 #include "CommonOutputDev.h"
14 class GFXOutputState {
19 char transparencygroup;
28 gfxresult_t* grouprecording; // for transparency groups
29 gfxresult_t* softmaskrecording; // for soft masks
31 gfxdevice_t* olddevice;
36 typedef struct _feature
42 void addGlobalFont(const char*filename);
43 void addGlobalLanguageDir(const char*dir);
44 void addGlobalFontDir(const char*dirname);
46 class GFXOutputGlobals {
48 feature_t*featurewarnings;
50 int textmodeinfo; // did we write "Text will be rendered as polygon" yet?
51 int jpeginfo; // did we write "File contains jpegs" yet?
52 int pbminfo; // did we write "File contains jpegs" yet?
53 int linkinfo; // did we write "File contains links" yet?
59 class GFXOutputDev: public CommonOutputDev {
63 GFXOutputDev(InfoOutputDev*info, PDFDoc*doc);
64 virtual ~GFXOutputDev() ;
66 virtual void setDevice(gfxdevice_t*dev);
67 virtual void setMove(int x,int y);
68 virtual void setClip(int x1,int y1,int x2,int y2);
69 virtual void setParameter(const char*key, const char*value);
72 virtual void startPage(int pageNum, GfxState *state, double x1, double y1, double x2, double y2) ;
73 virtual void endPage();
75 //----- get info about output device
77 // Does this device use upside-down coordinates?
78 // (Upside-down means (0,0) is the top left corner of the page.)
79 virtual GBool upsideDown();
81 // Does this device use drawChar() or drawString()?
82 virtual GBool useDrawChar();
84 virtual GBool interpretType3Chars();
86 //virtual GBool useShadedFills() { return gTrue; }
89 virtual void processLink(Link *link, Catalog *catalog);
91 //----- save/restore graphics state
92 virtual void saveState(GfxState *state) ;
93 virtual void restoreState(GfxState *state) ;
95 //----- update graphics state
97 virtual void updateLineDash(GfxState *state);
98 virtual void updateFont(GfxState *state);
99 virtual void updateFontMatrix(GfxState *state);
100 virtual void updateFillColor(GfxState *state);
101 virtual void updateStrokeColor(GfxState *state);
102 virtual void updateLineWidth(GfxState *state);
103 virtual void updateLineJoin(GfxState *state);
104 virtual void updateLineCap(GfxState *state);
105 virtual void updateFillOpacity(GfxState *state);
106 virtual void updateStrokeOpacity(GfxState *state);
107 virtual void updateFillOverprint(GfxState *state);
108 virtual void updateStrokeOverprint(GfxState *state);
109 virtual void updateTransfer(GfxState *state);
111 virtual void updateAll(GfxState *state)
114 updateFillColor(state);
115 updateStrokeColor(state);
116 updateLineWidth(state);
117 updateLineJoin(state);
118 updateLineCap(state);
121 //----- path painting
122 virtual void stroke(GfxState *state) ;
123 virtual void fill(GfxState *state) ;
124 virtual void eoFill(GfxState *state) ;
126 //----- path clipping
127 virtual void clip(GfxState *state) ;
128 virtual void eoClip(GfxState *state) ;
129 virtual void clipToStrokePath(GfxState *state);
132 virtual GBool useTilingPatternFill();
133 virtual GBool useShadedFills();
135 #if (xpdfMajorVersion < 3) || (xpdfMinorVersion < 2) || (xpdfUpdateVersion < 7)
136 virtual void tilingPatternFill(GfxState *state, Object *str,
137 int paintType, Dict *resDict,
138 double *mat, double *bbox,
139 int x0, int y0, int x1, int y1,
140 double xStep, double yStep);
142 virtual void tilingPatternFill(GfxState *state, Gfx *gfx, Object *str,
143 int paintType, Dict *resDict,
144 double *mat, double *bbox,
145 int x0, int y0, int x1, int y1,
146 double xStep, double yStep);
148 virtual GBool functionShadedFill(GfxState *state,
149 GfxFunctionShading *shading);
150 virtual GBool axialShadedFill(GfxState *state, GfxAxialShading *shading);
151 virtual GBool radialShadedFill(GfxState *state, GfxRadialShading *shading);
154 virtual void beginString(GfxState *state, GString *s) ;
155 virtual void endString(GfxState *state) ;
156 virtual void endTextObject(GfxState *state);
157 virtual void drawChar(GfxState *state, double x, double y,
158 double dx, double dy,
159 double originX, double originY,
160 CharCode code, int nBytes, Unicode *u, int uLen);
162 //----- image drawing
163 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
164 int width, int height, GBool invert,
166 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
167 int width, int height, GfxImageColorMap *colorMap,
168 int *maskColors, GBool inlineImg);
169 virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
170 int width, int height,
171 GfxImageColorMap *colorMap,
172 Stream *maskStr, int maskWidth, int maskHeight,
174 virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
175 int width, int height,
176 GfxImageColorMap *colorMap,
178 int maskWidth, int maskHeight,
179 GfxImageColorMap *maskColorMap);
181 //----- transparency groups and soft masks (xpdf >= ~ 3.01.16)
182 virtual void beginTransparencyGroup(GfxState *state, double *bbox,
183 GfxColorSpace *blendingColorSpace,
184 GBool isolated, GBool knockout,
186 virtual void endTransparencyGroup(GfxState *state);
187 virtual void paintTransparencyGroup(GfxState *state, double *bbox);
188 virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *backdropColor);
189 virtual void clearSoftMask(GfxState *state);
192 virtual GBool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen);
193 virtual void endType3Char(GfxState *state);
195 virtual void type3D0(GfxState *state, double wx, double wy);
196 virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury);
198 char* searchForSuitableFont(GfxFont*gfxFont);
202 virtual GBool useDrawForm();
203 virtual void drawForm(Ref id);
204 virtual GBool needNonText();
206 //virtual void dump();
207 //virtual void beginStringOp(GfxState *state);
208 //virtual void drawString(GfxState *state, GString *s);
209 //virtual void endStringOp(GfxState *state);
210 //virtual GBool getVectorAntialias() { return gFalse; }
211 //virtual void setVectorAntialias(GBool vaa) {}
212 //virtual void psXObject(Stream *psStream, Stream *level1Stream) {}
214 virtual void setPageMap(int*pagemap, int pagemap_len);
217 gfxline_t* gfxPath_to_gfxline(GfxState*state, GfxPath*path, int closed, int user_movex, int user_movey);
219 void transformXY(GfxState*state, double x, double y, double*nx, double*ny);
221 void drawGeneralImage(GfxState *state, Object *ref, Stream *str,
222 int width, int height, GfxImageColorMap*colorMap, GBool invert,
223 GBool inlineImg, int mask, int *maskColors,
224 Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GfxImageColorMap*maskColorMap);
226 void strokeGfxline(GfxState *state, gfxline_t*line, int flags);
227 void clipToGfxLine(GfxState *state, gfxline_t*line);
228 void fillGfxLine(GfxState *state, gfxline_t*line);
230 gfxfont_t* createGfxFont(GfxFont*xpdffont, FontInfo*src);
232 void showfeature(const char*feature,char fully, char warn);
233 void warnfeature(const char*feature,char fully);
234 void infofeature(const char*feature);
236 char* searchFont(const char*name);
237 char* substituteFont(GfxFont*gfxFont, char*oldname);
238 char* writeEmbeddedFontToFile(XRef*ref, GfxFont*font);
240 /* for page mapping */
246 char outer_clip_box; //whether the page clip box is still on
248 GFXOutputState states[64];
254 int type3active; // are we between beginType3()/endType3()?
258 int user_movex,user_movey;
259 int user_clipx1,user_clipx2,user_clipy1,user_clipy2;
261 /* upper left corner of clipping rectangle (cropbox)- needs to be
262 added to all drawing coordinates to give the impression that all
263 pages start at (0,0)*/
267 gfxline_t* current_text_stroke;
268 gfxline_t* current_text_clip;
269 gfxfont_t* current_gfxfont;
270 FontInfo*current_fontinfo;
271 gfxmatrix_t current_font_matrix;
274 int config_use_fontconfig;
275 int config_break_on_warning;
276 int config_remapunicode;
277 int config_transparent;
278 int config_extrafontdata;
279 int config_convertgradients;
280 int config_optimize_polygons;
283 double config_fontquality;
290 class GFXGlobalParams: public GlobalParams {
294 virtual DisplayFontParam *getDisplayFont(GString *fontName);
297 #endif //__gfxoutputdev_h__