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;
34 typedef struct _parameter
38 struct _parameter*next;
41 typedef struct _feature
47 void addGlobalFont(const char*filename);
48 void addGlobalLanguageDir(const char*dir);
49 void addGlobalFontDir(const char*dirname);
51 class GFXOutputDev: public CommonOutputDev {
55 GFXOutputDev(InfoOutputDev*info, PDFDoc*doc);
56 virtual ~GFXOutputDev() ;
58 virtual void setDevice(gfxdevice_t*dev);
59 virtual void setMove(int x,int y);
60 virtual void setClip(int x1,int y1,int x2,int y2);
61 virtual void setParameter(const char*key, const char*value);
64 virtual void startPage(int pageNum, GfxState *state, double x1, double y1, double x2, double y2) ;
65 virtual void endPage();
67 //----- get info about output device
69 // Does this device use upside-down coordinates?
70 // (Upside-down means (0,0) is the top left corner of the page.)
71 virtual GBool upsideDown();
73 // Does this device use drawChar() or drawString()?
74 virtual GBool useDrawChar();
76 virtual GBool interpretType3Chars();
78 //virtual GBool useShadedFills() { return gTrue; }
81 virtual void processLink(Link *link, Catalog *catalog);
83 //----- save/restore graphics state
84 virtual void saveState(GfxState *state) ;
85 virtual void restoreState(GfxState *state) ;
87 //----- update graphics state
89 virtual void updateLineDash(GfxState *state);
90 virtual void updateFont(GfxState *state);
91 virtual void updateFontMatrix(GfxState *state);
92 virtual void updateFillColor(GfxState *state);
93 virtual void updateStrokeColor(GfxState *state);
94 virtual void updateLineWidth(GfxState *state);
95 virtual void updateLineJoin(GfxState *state);
96 virtual void updateLineCap(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);
103 virtual void updateAll(GfxState *state)
106 updateFillColor(state);
107 updateStrokeColor(state);
108 updateLineWidth(state);
109 updateLineJoin(state);
110 updateLineCap(state);
113 //----- path painting
114 virtual void stroke(GfxState *state) ;
115 virtual void fill(GfxState *state) ;
116 virtual void eoFill(GfxState *state) ;
118 //----- path clipping
119 virtual void clip(GfxState *state) ;
120 virtual void eoClip(GfxState *state) ;
121 virtual void clipToStrokePath(GfxState *state);
124 virtual GBool useTilingPatternFill();
125 virtual GBool useShadedFills();
127 #if (xpdfMajorVersion < 3) || (xpdfMinorVersion < 2) || (xpdfUpdateVersion < 7)
128 virtual void tilingPatternFill(GfxState *state, Object *str,
129 int paintType, Dict *resDict,
130 double *mat, double *bbox,
131 int x0, int y0, int x1, int y1,
132 double xStep, double yStep);
134 virtual void tilingPatternFill(GfxState *state, Gfx *gfx, Object *str,
135 int paintType, Dict *resDict,
136 double *mat, double *bbox,
137 int x0, int y0, int x1, int y1,
138 double xStep, double yStep);
140 virtual GBool functionShadedFill(GfxState *state,
141 GfxFunctionShading *shading);
142 virtual GBool axialShadedFill(GfxState *state, GfxAxialShading *shading);
143 virtual GBool radialShadedFill(GfxState *state, GfxRadialShading *shading);
146 virtual void beginString(GfxState *state, GString *s) ;
147 virtual void endString(GfxState *state) ;
148 virtual void endTextObject(GfxState *state);
149 virtual void drawChar(GfxState *state, double x, double y,
150 double dx, double dy,
151 double originX, double originY,
152 CharCode code, int nBytes, Unicode *u, int uLen);
154 //----- image drawing
155 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
156 int width, int height, GBool invert,
158 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
159 int width, int height, GfxImageColorMap *colorMap,
160 int *maskColors, GBool inlineImg);
161 virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
162 int width, int height,
163 GfxImageColorMap *colorMap,
164 Stream *maskStr, int maskWidth, int maskHeight,
166 virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
167 int width, int height,
168 GfxImageColorMap *colorMap,
170 int maskWidth, int maskHeight,
171 GfxImageColorMap *maskColorMap);
173 //----- transparency groups and soft masks (xpdf >= ~ 3.01.16)
174 virtual void beginTransparencyGroup(GfxState *state, double *bbox,
175 GfxColorSpace *blendingColorSpace,
176 GBool isolated, GBool knockout,
178 virtual void endTransparencyGroup(GfxState *state);
179 virtual void paintTransparencyGroup(GfxState *state, double *bbox);
180 virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *backdropColor);
181 virtual void clearSoftMask(GfxState *state);
184 virtual GBool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen);
185 virtual void endType3Char(GfxState *state);
187 virtual void type3D0(GfxState *state, double wx, double wy);
188 virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury);
190 virtual void preparePage(int pdfpage, int outputpage);
192 char* searchForSuitableFont(GfxFont*gfxFont);
196 virtual GBool useDrawForm();
197 virtual void drawForm(Ref id);
198 virtual GBool needNonText();
200 //virtual void dump();
201 //virtual void beginStringOp(GfxState *state);
202 //virtual void drawString(GfxState *state, GString *s);
203 //virtual void endStringOp(GfxState *state);
204 //virtual GBool getVectorAntialias() { return gFalse; }
205 //virtual void setVectorAntialias(GBool vaa) {}
206 //virtual void psXObject(Stream *psStream, Stream *level1Stream) {}
209 gfxline_t* gfxPath_to_gfxline(GfxState*state, GfxPath*path, int closed, int user_movex, int user_movey);
211 void transformXY(GfxState*state, double x, double y, double*nx, double*ny);
213 void drawGeneralImage(GfxState *state, Object *ref, Stream *str,
214 int width, int height, GfxImageColorMap*colorMap, GBool invert,
215 GBool inlineImg, int mask, int *maskColors,
216 Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GfxImageColorMap*maskColorMap);
217 int setGfxFont(char*id, char*name, char*filename, double maxSize, CharCodeToUnicode*ctu);
218 void strokeGfxline(GfxState *state, gfxline_t*line, int flags);
219 void clipToGfxLine(GfxState *state, gfxline_t*line);
220 void fillGfxLine(GfxState *state, gfxline_t*line);
222 void showfeature(const char*feature,char fully, char warn);
223 void warnfeature(const char*feature,char fully);
224 void infofeature(const char*feature);
226 feature_t*featurewarnings;
228 char outer_clip_box; //whether the page clip box is still on
230 gfxfontlist_t*gfxfontlist;
232 GBool do_interpretType3Chars;
235 GFXOutputState states[64];
243 char* searchFont(const char*name);
244 char* substituteFont(GfxFont*gfxFont, char*oldname);
245 char* writeEmbeddedFontToFile(XRef*ref, GfxFont*font);
247 int textmodeinfo; // did we write "Text will be rendered as polygon" yet?
248 int jpeginfo; // did we write "File contains jpegs" yet?
249 int pbminfo; // did we write "File contains jpegs" yet?
250 int linkinfo; // did we write "File contains links" yet?
252 int type3active; // are we between beginType3()/endType3()?
258 const char* substitutetarget[256];
259 const char* substitutesource[256];
262 int user_movex,user_movey;
263 int user_clipx1,user_clipx2,user_clipy1,user_clipy2;
265 /* upper left corner of clipping rectangle (cropbox)- needs to be
266 added to all drawing coordinates to give the impression that all
267 pages start at (0,0)*/
271 gfxline_t* current_text_stroke;
272 gfxline_t* current_text_clip;
273 gfxfont_t* current_gfxfont;
274 FontInfo*current_fontinfo;
275 gfxmatrix_t current_font_matrix;
282 int config_use_fontconfig;
283 int config_break_on_warning;
284 int config_remapunicode;
285 int config_transparent;
286 int config_extrafontdata;
287 int config_convertgradients;
288 int config_optimize_polygons;
289 double config_fontquality;
295 parameter_t*parameters;
298 class GFXGlobalParams: public GlobalParams {
302 virtual DisplayFontParam *getDisplayFont(GString *fontName);
305 #endif //__gfxoutputdev_h__