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 virtual void processLink(Link *link, Catalog *catalog);
88 //----- save/restore graphics state
89 virtual void saveState(GfxState *state) ;
90 virtual void restoreState(GfxState *state) ;
92 //----- update graphics state
94 virtual void updateFont(GfxState *state);
95 virtual void updateFillColor(GfxState *state);
96 virtual void updateStrokeColor(GfxState *state);
97 virtual void updateLineWidth(GfxState *state);
98 virtual void updateLineJoin(GfxState *state);
99 virtual void updateLineCap(GfxState *state);
100 virtual void updateFillOpacity(GfxState *state);
101 virtual void updateStrokeOpacity(GfxState *state);
102 virtual void updateFillOverprint(GfxState *state);
103 virtual void updateStrokeOverprint(GfxState *state);
104 virtual void updateTransfer(GfxState *state);
106 virtual void updateAll(GfxState *state)
109 updateFillColor(state);
110 updateStrokeColor(state);
111 updateLineWidth(state);
112 updateLineJoin(state);
113 updateLineCap(state);
116 //----- path painting
117 virtual void stroke(GfxState *state) ;
118 virtual void fill(GfxState *state) ;
119 virtual void eoFill(GfxState *state) ;
121 //----- path clipping
122 virtual void clip(GfxState *state) ;
123 virtual void eoClip(GfxState *state) ;
126 virtual GBool useTilingPatternFill();
127 virtual GBool useShadedFills();
130 virtual void tilingPatternFill(GfxState *state, Object *str,
131 int paintType, Dict *resDict,
132 double *mat, double *bbox,
133 int x0, int y0, int x1, int y1,
134 double xStep, double yStep) {}
135 virtual void functionShadedFill(GfxState *state,
136 GfxFunctionShading *shading) {}
137 virtual void axialShadedFill(GfxState *state, GfxAxialShading *shading) {}
138 virtual void radialShadedFill(GfxState *state, GfxRadialShading *shading) {}
142 virtual void beginString(GfxState *state, GString *s) ;
143 virtual void endString(GfxState *state) ;
144 virtual void endTextObject(GfxState *state);
145 virtual void drawChar(GfxState *state, double x, double y,
146 double dx, double dy,
147 double originX, double originY,
148 CharCode code, int nBytes, Unicode *u, int uLen);
150 //----- image drawing
151 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
152 int width, int height, GBool invert,
154 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
155 int width, int height, GfxImageColorMap *colorMap,
156 int *maskColors, GBool inlineImg);
157 virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
158 int width, int height,
159 GfxImageColorMap *colorMap,
160 Stream *maskStr, int maskWidth, int maskHeight,
162 virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
163 int width, int height,
164 GfxImageColorMap *colorMap,
166 int maskWidth, int maskHeight,
167 GfxImageColorMap *maskColorMap);
169 //----- transparency groups and soft masks (xpdf >= ~ 3.01.16)
170 #if xpdfUpdateVersion >= 16
171 virtual void beginTransparencyGroup(GfxState *state, double *bbox,
172 GfxColorSpace *blendingColorSpace,
173 GBool isolated, GBool knockout,
175 virtual void endTransparencyGroup(GfxState *state);
176 virtual void paintTransparencyGroup(GfxState *state, double *bbox);
177 virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *backdropColor);
178 virtual void clearSoftMask(GfxState *state);
180 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 void preparePage(int pdfpage, int outputpage);
192 char* searchForSuitableFont(GfxFont*gfxFont);
197 void drawGeneralImage(GfxState *state, Object *ref, Stream *str,
198 int width, int height, GfxImageColorMap*colorMap, GBool invert,
199 GBool inlineImg, int mask, int *maskColors,
200 Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GfxImageColorMap*maskColorMap);
201 int setGfxFont(char*id, char*name, char*filename, double quality);
202 void strokeGfxline(GfxState *state, gfxline_t*line);
203 void clipToGfxLine(GfxState *state, gfxline_t*line);
204 void fillGfxLine(GfxState *state, gfxline_t*line);
206 void showfeature(char*feature,char fully, char warn);
207 void warnfeature(char*feature,char fully);
208 void infofeature(char*feature);
210 char outer_clip_box; //whether the page clip box is still on
213 GFXOutputState states[64];
221 char* searchFont(char*name);
222 char* substituteFont(GfxFont*gfxFont, char*oldname);
223 char* writeEmbeddedFontToFile(XRef*ref, GfxFont*font);
225 int textmodeinfo; // did we write "Text will be rendered as polygon" yet?
226 int jpeginfo; // did we write "File contains jpegs" yet?
227 int pbminfo; // did we write "File contains jpegs" yet?
228 int linkinfo; // did we write "File contains links" yet?
230 int type3active; // are we between beginType3()/endType3()?
236 char* substitutetarget[256];
237 char* substitutesource[256];
240 int user_movex,user_movey;
241 int user_clipx1,user_clipx2,user_clipy1,user_clipy2;
243 /* upper left corner of clipping rectangle (cropbox)- needs to be
244 added to all drawing coordinates to give the impression that all
245 pages start at (0,0)*/
251 gfxline_t* current_text_stroke;
252 gfxline_t* current_text_clip;
253 char* current_font_id;
254 gfxfont_t* current_gfxfont;
255 gfxmatrix_t current_font_matrix;
257 fontlist_t* fontlist;
264 int config_use_fontconfig;
265 int config_break_on_warning;
267 parameter_t*parameters;
270 #endif //__gfxoutputdev_h__