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);
61 void setInfo(InfoOutputDev*info) {this->info = info;}
64 void startFrame(int width, int height);
66 virtual void startPage(int pageNum, GfxState *state, double x1, double y1, double x2, double y2) ;
70 //----- get info about output device
72 // Does this device use upside-down coordinates?
73 // (Upside-down means (0,0) is the top left corner of the page.)
74 virtual GBool upsideDown();
76 // Does this device use drawChar() or drawString()?
77 virtual GBool useDrawChar();
79 virtual GBool interpretType3Chars();
81 //virtual GBool useShadedFills() { return gTrue; }
83 //----- initialization and control
85 void setXRef(PDFDoc*doc, XRef *xref);
88 virtual void processLink(Link *link, Catalog *catalog);
90 //----- save/restore graphics state
91 virtual void saveState(GfxState *state) ;
92 virtual void restoreState(GfxState *state) ;
94 //----- update graphics state
96 virtual void updateFont(GfxState *state);
97 virtual void updateFillColor(GfxState *state);
98 virtual void updateStrokeColor(GfxState *state);
99 virtual void updateLineWidth(GfxState *state);
100 virtual void updateLineJoin(GfxState *state);
101 virtual void updateLineCap(GfxState *state);
102 virtual void updateFillOpacity(GfxState *state);
103 virtual void updateStrokeOpacity(GfxState *state);
104 virtual void updateFillOverprint(GfxState *state);
105 virtual void updateStrokeOverprint(GfxState *state);
106 virtual void updateTransfer(GfxState *state);
108 virtual void updateAll(GfxState *state)
111 updateFillColor(state);
112 updateStrokeColor(state);
113 updateLineWidth(state);
114 updateLineJoin(state);
115 updateLineCap(state);
118 //----- path painting
119 virtual void stroke(GfxState *state) ;
120 virtual void fill(GfxState *state) ;
121 virtual void eoFill(GfxState *state) ;
123 //----- path clipping
124 virtual void clip(GfxState *state) ;
125 virtual void eoClip(GfxState *state) ;
128 virtual GBool useTilingPatternFill();
129 virtual GBool useShadedFills();
132 virtual void tilingPatternFill(GfxState *state, Object *str,
133 int paintType, Dict *resDict,
134 double *mat, double *bbox,
135 int x0, int y0, int x1, int y1,
136 double xStep, double yStep) {}
137 virtual void functionShadedFill(GfxState *state,
138 GfxFunctionShading *shading) {}
139 virtual void axialShadedFill(GfxState *state, GfxAxialShading *shading) {}
140 virtual void radialShadedFill(GfxState *state, GfxRadialShading *shading) {}
144 virtual void beginString(GfxState *state, GString *s) ;
145 virtual void endString(GfxState *state) ;
146 virtual void endTextObject(GfxState *state);
147 virtual void drawChar(GfxState *state, double x, double y,
148 double dx, double dy,
149 double originX, double originY,
150 CharCode code, int nBytes, Unicode *u, int uLen);
152 //----- image drawing
153 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
154 int width, int height, GBool invert,
156 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
157 int width, int height, GfxImageColorMap *colorMap,
158 int *maskColors, GBool inlineImg);
159 virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
160 int width, int height,
161 GfxImageColorMap *colorMap,
162 Stream *maskStr, int maskWidth, int maskHeight,
164 virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
165 int width, int height,
166 GfxImageColorMap *colorMap,
168 int maskWidth, int maskHeight,
169 GfxImageColorMap *maskColorMap);
171 //----- transparency groups and soft masks (xpdf >= ~ 3.01.16)
172 virtual void beginTransparencyGroup(GfxState *state, double *bbox,
173 GfxColorSpace *blendingColorSpace,
174 GBool isolated, GBool knockout,
176 virtual void endTransparencyGroup(GfxState *state);
177 virtual void paintTransparencyGroup(GfxState *state, double *bbox);
178 virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *backdropColor);
179 virtual void clearSoftMask(GfxState *state);
182 virtual GBool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen);
183 virtual void endType3Char(GfxState *state);
185 virtual void type3D0(GfxState *state, double wx, double wy);
186 virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury);
188 void preparePage(int pdfpage, int outputpage);
190 char* searchForSuitableFont(GfxFont*gfxFont);
195 void drawGeneralImage(GfxState *state, Object *ref, Stream *str,
196 int width, int height, GfxImageColorMap*colorMap, GBool invert,
197 GBool inlineImg, int mask, int *maskColors,
198 Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GfxImageColorMap*maskColorMap);
199 int setGfxFont(char*id, char*name, char*filename, double quality);
200 void strokeGfxline(GfxState *state, gfxline_t*line);
201 void clipToGfxLine(GfxState *state, gfxline_t*line);
202 void fillGfxLine(GfxState *state, gfxline_t*line);
204 void showfeature(char*feature,char fully, char warn);
205 void warnfeature(char*feature,char fully);
206 void infofeature(char*feature);
208 char outer_clip_box; //whether the page clip box is still on
211 GFXOutputState states[64];
219 char* searchFont(char*name);
220 char* substituteFont(GfxFont*gfxFont, char*oldname);
221 char* writeEmbeddedFontToFile(XRef*ref, GfxFont*font);
223 int textmodeinfo; // did we write "Text will be rendered as polygon" yet?
224 int jpeginfo; // did we write "File contains jpegs" yet?
225 int pbminfo; // did we write "File contains jpegs" yet?
226 int linkinfo; // did we write "File contains links" yet?
228 int type3active; // are we between beginType3()/endType3()?
234 char* substitutetarget[256];
235 char* substitutesource[256];
238 int user_movex,user_movey;
239 int user_clipx1,user_clipx2,user_clipy1,user_clipy2;
241 /* upper left corner of clipping rectangle (cropbox)- needs to be
242 added to all drawing coordinates to give the impression that all
243 pages start at (0,0)*/
249 gfxline_t* current_text_stroke;
250 gfxline_t* current_text_clip;
251 char* current_font_id;
252 gfxfont_t* current_gfxfont;
253 gfxmatrix_t current_font_matrix;
255 fontlist_t* fontlist;
262 int config_use_fontconfig;
263 int config_break_on_warning;
265 parameter_t*parameters;
268 #endif //__gfxoutputdev_h__