1 #ifndef __gfxoutputdev_h__
2 #define __gfxoutputdev_h__
4 #include "../gfxdevice.h"
5 #include "../gfxsource.h"
8 #include "InfoOutputDev.h"
11 typedef struct _fontlist
18 class GFXOutputState {
23 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 void addGlobalFont(char*filename);
42 void addGlobalLanguageDir(char*dir);
43 void addGlobalFontDir(char*dirname);
45 class GFXOutputDev: public OutputDev {
50 GFXOutputDev(parameter_t*p);
51 void setDevice(gfxdevice_t*dev);
54 virtual ~GFXOutputDev() ;
56 void setMove(int x,int y);
57 void setClip(int x1,int y1,int x2,int y2);
59 void setInfo(InfoOutputDev*info) {this->info = info;}
62 void startFrame(int width, int height);
64 virtual void startPage(int pageNum, GfxState *state, double x1, double y1, double x2, double y2) ;
68 //----- get info about output device
70 // Does this device use upside-down coordinates?
71 // (Upside-down means (0,0) is the top left corner of the page.)
72 virtual GBool upsideDown();
74 // Does this device use drawChar() or drawString()?
75 virtual GBool useDrawChar();
77 virtual GBool interpretType3Chars();
79 //virtual GBool useShadedFills() { return gTrue; }
81 //----- initialization and control
83 void setXRef(PDFDoc*doc, XRef *xref);
86 #if xpdfUpdateVersion >= 16
87 virtual void processLink(Link *link, Catalog *catalog);
89 virtual void drawLink(Link *link, Catalog *catalog);
92 //----- save/restore graphics state
93 virtual void saveState(GfxState *state) ;
94 virtual void restoreState(GfxState *state) ;
96 //----- update graphics state
98 virtual void updateFont(GfxState *state);
99 virtual void updateFillColor(GfxState *state);
100 virtual void updateStrokeColor(GfxState *state);
101 virtual void updateLineWidth(GfxState *state);
102 virtual void updateLineJoin(GfxState *state);
103 virtual void updateLineCap(GfxState *state);
104 virtual void updateFillOpacity(GfxState *state);
105 virtual void updateStrokeOpacity(GfxState *state);
106 virtual void updateFillOverprint(GfxState *state);
107 virtual void updateStrokeOverprint(GfxState *state);
108 virtual void updateTransfer(GfxState *state);
110 virtual void updateAll(GfxState *state)
113 updateFillColor(state);
114 updateStrokeColor(state);
115 updateLineWidth(state);
116 updateLineJoin(state);
117 updateLineCap(state);
120 //----- path painting
121 virtual void stroke(GfxState *state) ;
122 virtual void fill(GfxState *state) ;
123 virtual void eoFill(GfxState *state) ;
125 //----- path clipping
126 virtual void clip(GfxState *state) ;
127 virtual void eoClip(GfxState *state) ;
130 virtual GBool useTilingPatternFill();
131 virtual GBool useShadedFills();
134 virtual void tilingPatternFill(GfxState *state, 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) {}
139 virtual void functionShadedFill(GfxState *state,
140 GfxFunctionShading *shading) {}
141 virtual void axialShadedFill(GfxState *state, GfxAxialShading *shading) {}
142 virtual void 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 #if xpdfUpdateVersion >= 16
175 virtual void beginTransparencyGroup(GfxState *state, double *bbox,
176 GfxColorSpace *blendingColorSpace,
177 GBool isolated, GBool knockout,
179 virtual void endTransparencyGroup(GfxState *state);
180 virtual void paintTransparencyGroup(GfxState *state, double *bbox);
181 virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *backdropColor);
182 virtual void clearSoftMask(GfxState *state);
184 virtual void clearSoftMask(GfxState *state) {};
188 virtual GBool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen);
189 virtual void endType3Char(GfxState *state);
191 virtual void type3D0(GfxState *state, double wx, double wy);
192 virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury);
194 void preparePage(int pdfpage, int outputpage);
196 char* searchForSuitableFont(GfxFont*gfxFont);
201 void drawGeneralImage(GfxState *state, Object *ref, Stream *str,
202 int width, int height, GfxImageColorMap*colorMap, GBool invert,
203 GBool inlineImg, int mask, int *maskColors,
204 Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GfxImageColorMap*maskColorMap);
205 int setGfxFont(char*id, char*name, char*filename, double quality);
206 void strokeGfxline(GfxState *state, gfxline_t*line);
207 void clipToGfxLine(GfxState *state, gfxline_t*line);
208 void fillGfxLine(GfxState *state, gfxline_t*line);
210 void showfeature(char*feature,char fully, char warn);
211 void warnfeature(char*feature,char fully);
212 void infofeature(char*feature);
214 char outer_clip_box; //whether the page clip box is still on
217 GFXOutputState states[64];
225 char* searchFont(char*name);
226 char* substituteFont(GfxFont*gfxFont, char*oldname);
227 char* writeEmbeddedFontToFile(XRef*ref, GfxFont*font);
229 int textmodeinfo; // did we write "Text will be rendered as polygon" yet?
230 int jpeginfo; // did we write "File contains jpegs" yet?
231 int pbminfo; // did we write "File contains jpegs" yet?
232 int linkinfo; // did we write "File contains links" yet?
234 int type3active; // are we between beginType3()/endType3()?
240 char* substitutetarget[256];
241 char* substitutesource[256];
244 int user_movex,user_movey;
245 int user_clipx1,user_clipx2,user_clipy1,user_clipy2;
247 /* upper left corner of clipping rectangle (cropbox)- needs to be
248 added to all drawing coordinates to give the impression that all
249 pages start at (0,0)*/
255 gfxline_t* current_text_stroke;
256 gfxline_t* current_text_clip;
257 char* current_font_id;
258 gfxfont_t* current_gfxfont;
259 gfxmatrix_t current_font_matrix;
261 fontlist_t* fontlist;
268 int config_use_fontconfig;
269 int config_break_on_warning;
271 parameter_t*parameters;
274 #endif //__gfxoutputdev_h__