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;
30 gfxresult_t* grouprecording; // for transparency groups
31 gfxresult_t* softmaskrecording; // for soft masks
33 gfxdevice_t* olddevice;
36 typedef struct _parameter
40 struct _parameter*next;
43 void addGlobalFont(char*filename);
44 void addGlobalLanguageDir(char*dir);
45 void addGlobalFontDir(char*dirname);
47 class GFXOutputDev: public OutputDev {
52 GFXOutputDev(parameter_t*p);
53 void setDevice(gfxdevice_t*dev);
56 virtual ~GFXOutputDev() ;
58 void setMove(int x,int y);
59 void setClip(int x1,int y1,int x2,int y2);
60 void setParameter(char*key, char*value);
62 void setInfo(InfoOutputDev*info) {this->info = info;}
65 void startFrame(int width, int height);
67 virtual void startPage(int pageNum, GfxState *state, double x1, double y1, double x2, double y2) ;
71 //----- get info about output device
73 // Does this device use upside-down coordinates?
74 // (Upside-down means (0,0) is the top left corner of the page.)
75 virtual GBool upsideDown();
77 // Does this device use drawChar() or drawString()?
78 virtual GBool useDrawChar();
80 virtual GBool interpretType3Chars();
82 //virtual GBool useShadedFills() { return gTrue; }
84 //----- initialization and control
86 void setXRef(PDFDoc*doc, XRef *xref);
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 updateFont(GfxState *state);
98 virtual void updateFillColor(GfxState *state);
99 virtual void updateStrokeColor(GfxState *state);
100 virtual void updateLineWidth(GfxState *state);
101 virtual void updateLineJoin(GfxState *state);
102 virtual void updateLineCap(GfxState *state);
103 virtual void updateFillOpacity(GfxState *state);
104 virtual void updateStrokeOpacity(GfxState *state);
105 virtual void updateFillOverprint(GfxState *state);
106 virtual void updateStrokeOverprint(GfxState *state);
107 virtual void updateTransfer(GfxState *state);
109 virtual void updateAll(GfxState *state)
112 updateFillColor(state);
113 updateStrokeColor(state);
114 updateLineWidth(state);
115 updateLineJoin(state);
116 updateLineCap(state);
119 //----- path painting
120 virtual void stroke(GfxState *state) ;
121 virtual void fill(GfxState *state) ;
122 virtual void eoFill(GfxState *state) ;
124 //----- path clipping
125 virtual void clip(GfxState *state) ;
126 virtual void eoClip(GfxState *state) ;
129 virtual GBool useTilingPatternFill();
130 virtual GBool useShadedFills();
133 virtual void tilingPatternFill(GfxState *state, Object *str,
134 int paintType, Dict *resDict,
135 double *mat, double *bbox,
136 int x0, int y0, int x1, int y1,
137 double xStep, double yStep) {}
138 virtual void functionShadedFill(GfxState *state,
139 GfxFunctionShading *shading) {}
140 virtual void axialShadedFill(GfxState *state, GfxAxialShading *shading) {}
141 virtual void radialShadedFill(GfxState *state, GfxRadialShading *shading) {}
145 virtual void beginString(GfxState *state, GString *s) ;
146 virtual void endString(GfxState *state) ;
147 virtual void endTextObject(GfxState *state);
148 virtual void drawChar(GfxState *state, double x, double y,
149 double dx, double dy,
150 double originX, double originY,
151 CharCode code, int nBytes, Unicode *u, int uLen);
153 //----- image drawing
154 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
155 int width, int height, GBool invert,
157 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
158 int width, int height, GfxImageColorMap *colorMap,
159 int *maskColors, GBool inlineImg);
160 virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
161 int width, int height,
162 GfxImageColorMap *colorMap,
163 Stream *maskStr, int maskWidth, int maskHeight,
165 virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
166 int width, int height,
167 GfxImageColorMap *colorMap,
169 int maskWidth, int maskHeight,
170 GfxImageColorMap *maskColorMap);
172 //----- transparency groups and soft masks (xpdf >= ~ 3.01.16)
173 virtual void beginTransparencyGroup(GfxState *state, double *bbox,
174 GfxColorSpace *blendingColorSpace,
175 GBool isolated, GBool knockout,
177 virtual void endTransparencyGroup(GfxState *state);
178 virtual void paintTransparencyGroup(GfxState *state, double *bbox);
179 virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *backdropColor);
180 virtual void clearSoftMask(GfxState *state);
183 virtual GBool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen);
184 virtual void endType3Char(GfxState *state);
186 virtual void type3D0(GfxState *state, double wx, double wy);
187 virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury);
189 void preparePage(int pdfpage, int outputpage);
191 char* searchForSuitableFont(GfxFont*gfxFont);
196 void drawGeneralImage(GfxState *state, Object *ref, Stream *str,
197 int width, int height, GfxImageColorMap*colorMap, GBool invert,
198 GBool inlineImg, int mask, int *maskColors,
199 Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GfxImageColorMap*maskColorMap);
200 int setGfxFont(char*id, char*name, char*filename, double quality);
201 void strokeGfxline(GfxState *state, gfxline_t*line);
202 void clipToGfxLine(GfxState *state, gfxline_t*line);
203 void fillGfxLine(GfxState *state, gfxline_t*line);
205 void showfeature(char*feature,char fully, char warn);
206 void warnfeature(char*feature,char fully);
207 void infofeature(char*feature);
209 char outer_clip_box; //whether the page clip box is still on
211 GBool do_interpretType3Chars;
214 GFXOutputState states[64];
222 char* searchFont(char*name);
223 char* substituteFont(GfxFont*gfxFont, char*oldname);
224 char* writeEmbeddedFontToFile(XRef*ref, GfxFont*font);
226 int textmodeinfo; // did we write "Text will be rendered as polygon" yet?
227 int jpeginfo; // did we write "File contains jpegs" yet?
228 int pbminfo; // did we write "File contains jpegs" yet?
229 int linkinfo; // did we write "File contains links" yet?
231 int type3active; // are we between beginType3()/endType3()?
237 char* substitutetarget[256];
238 char* substitutesource[256];
241 int user_movex,user_movey;
242 int user_clipx1,user_clipx2,user_clipy1,user_clipy2;
244 /* upper left corner of clipping rectangle (cropbox)- needs to be
245 added to all drawing coordinates to give the impression that all
246 pages start at (0,0)*/
252 gfxline_t* current_text_stroke;
253 gfxline_t* current_text_clip;
254 char* current_font_id;
255 gfxfont_t* current_gfxfont;
256 gfxmatrix_t current_font_matrix;
258 fontlist_t* fontlist;
265 int config_use_fontconfig;
266 int config_break_on_warning;
268 parameter_t*parameters;
271 #endif //__gfxoutputdev_h__