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;
36 typedef struct _feature
42 void addGlobalFont(const char*filename);
43 void addGlobalLanguageDir(const char*dir);
44 void addGlobalFontDir(const char*dirname);
46 class GFXOutputDev: public CommonOutputDev {
50 GFXOutputDev(InfoOutputDev*info, PDFDoc*doc);
51 virtual ~GFXOutputDev() ;
53 virtual void setDevice(gfxdevice_t*dev);
54 virtual void setMove(int x,int y);
55 virtual void setClip(int x1,int y1,int x2,int y2);
56 virtual void setParameter(const char*key, const char*value);
59 virtual void startPage(int pageNum, GfxState *state, double x1, double y1, double x2, double y2) ;
60 virtual void endPage();
62 //----- get info about output device
64 // Does this device use upside-down coordinates?
65 // (Upside-down means (0,0) is the top left corner of the page.)
66 virtual GBool upsideDown();
68 // Does this device use drawChar() or drawString()?
69 virtual GBool useDrawChar();
71 virtual GBool interpretType3Chars();
73 //virtual GBool useShadedFills() { return gTrue; }
76 virtual void processLink(Link *link, Catalog *catalog);
78 //----- save/restore graphics state
79 virtual void saveState(GfxState *state) ;
80 virtual void restoreState(GfxState *state) ;
82 //----- update graphics state
84 virtual void updateLineDash(GfxState *state);
85 virtual void updateFont(GfxState *state);
86 virtual void updateFontMatrix(GfxState *state);
87 virtual void updateFillColor(GfxState *state);
88 virtual void updateStrokeColor(GfxState *state);
89 virtual void updateLineWidth(GfxState *state);
90 virtual void updateLineJoin(GfxState *state);
91 virtual void updateLineCap(GfxState *state);
92 virtual void updateFillOpacity(GfxState *state);
93 virtual void updateStrokeOpacity(GfxState *state);
94 virtual void updateFillOverprint(GfxState *state);
95 virtual void updateStrokeOverprint(GfxState *state);
96 virtual void updateTransfer(GfxState *state);
98 virtual void updateAll(GfxState *state)
101 updateFillColor(state);
102 updateStrokeColor(state);
103 updateLineWidth(state);
104 updateLineJoin(state);
105 updateLineCap(state);
108 //----- path painting
109 virtual void stroke(GfxState *state) ;
110 virtual void fill(GfxState *state) ;
111 virtual void eoFill(GfxState *state) ;
113 //----- path clipping
114 virtual void clip(GfxState *state) ;
115 virtual void eoClip(GfxState *state) ;
116 virtual void clipToStrokePath(GfxState *state);
119 virtual GBool useTilingPatternFill();
120 virtual GBool useShadedFills();
122 #if (xpdfMajorVersion < 3) || (xpdfMinorVersion < 2) || (xpdfUpdateVersion < 7)
123 virtual void tilingPatternFill(GfxState *state, Object *str,
124 int paintType, Dict *resDict,
125 double *mat, double *bbox,
126 int x0, int y0, int x1, int y1,
127 double xStep, double yStep);
129 virtual void tilingPatternFill(GfxState *state, Gfx *gfx, Object *str,
130 int paintType, Dict *resDict,
131 double *mat, double *bbox,
132 int x0, int y0, int x1, int y1,
133 double xStep, double yStep);
135 virtual GBool functionShadedFill(GfxState *state,
136 GfxFunctionShading *shading);
137 virtual GBool axialShadedFill(GfxState *state, GfxAxialShading *shading);
138 virtual GBool radialShadedFill(GfxState *state, GfxRadialShading *shading);
141 virtual void beginString(GfxState *state, GString *s) ;
142 virtual void endString(GfxState *state) ;
143 virtual void endTextObject(GfxState *state);
144 virtual void drawChar(GfxState *state, double x, double y,
145 double dx, double dy,
146 double originX, double originY,
147 CharCode code, int nBytes, Unicode *u, int uLen);
149 //----- image drawing
150 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
151 int width, int height, GBool invert,
153 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
154 int width, int height, GfxImageColorMap *colorMap,
155 int *maskColors, GBool inlineImg);
156 virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
157 int width, int height,
158 GfxImageColorMap *colorMap,
159 Stream *maskStr, int maskWidth, int maskHeight,
161 virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
162 int width, int height,
163 GfxImageColorMap *colorMap,
165 int maskWidth, int maskHeight,
166 GfxImageColorMap *maskColorMap);
168 //----- transparency groups and soft masks (xpdf >= ~ 3.01.16)
169 virtual void beginTransparencyGroup(GfxState *state, double *bbox,
170 GfxColorSpace *blendingColorSpace,
171 GBool isolated, GBool knockout,
173 virtual void endTransparencyGroup(GfxState *state);
174 virtual void paintTransparencyGroup(GfxState *state, double *bbox);
175 virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *backdropColor);
176 virtual void clearSoftMask(GfxState *state);
179 virtual GBool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen);
180 virtual void endType3Char(GfxState *state);
182 virtual void type3D0(GfxState *state, double wx, double wy);
183 virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury);
185 virtual void preparePage(int pdfpage, int outputpage);
187 char* searchForSuitableFont(GfxFont*gfxFont);
191 virtual GBool useDrawForm();
192 virtual void drawForm(Ref id);
193 virtual GBool needNonText();
195 //virtual void dump();
196 //virtual void beginStringOp(GfxState *state);
197 //virtual void drawString(GfxState *state, GString *s);
198 //virtual void endStringOp(GfxState *state);
199 //virtual GBool getVectorAntialias() { return gFalse; }
200 //virtual void setVectorAntialias(GBool vaa) {}
201 //virtual void psXObject(Stream *psStream, Stream *level1Stream) {}
204 gfxline_t* gfxPath_to_gfxline(GfxState*state, GfxPath*path, int closed, int user_movex, int user_movey);
206 void transformXY(GfxState*state, double x, double y, double*nx, double*ny);
208 void drawGeneralImage(GfxState *state, Object *ref, Stream *str,
209 int width, int height, GfxImageColorMap*colorMap, GBool invert,
210 GBool inlineImg, int mask, int *maskColors,
211 Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GfxImageColorMap*maskColorMap);
213 void strokeGfxline(GfxState *state, gfxline_t*line, int flags);
214 void clipToGfxLine(GfxState *state, gfxline_t*line);
215 void fillGfxLine(GfxState *state, gfxline_t*line);
217 void showfeature(const char*feature,char fully, char warn);
218 void warnfeature(const char*feature,char fully);
219 void infofeature(const char*feature);
221 feature_t*featurewarnings;
223 char outer_clip_box; //whether the page clip box is still on
225 gfxfontlist_t*gfxfontlist;
227 GBool do_interpretType3Chars;
230 GFXOutputState states[64];
238 char* searchFont(const char*name);
239 char* substituteFont(GfxFont*gfxFont, char*oldname);
240 char* writeEmbeddedFontToFile(XRef*ref, GfxFont*font);
242 int textmodeinfo; // did we write "Text will be rendered as polygon" yet?
243 int jpeginfo; // did we write "File contains jpegs" yet?
244 int pbminfo; // did we write "File contains jpegs" yet?
245 int linkinfo; // did we write "File contains links" yet?
247 int type3active; // are we between beginType3()/endType3()?
253 const char* substitutetarget[256];
254 const char* substitutesource[256];
257 int user_movex,user_movey;
258 int user_clipx1,user_clipx2,user_clipy1,user_clipy2;
260 /* upper left corner of clipping rectangle (cropbox)- needs to be
261 added to all drawing coordinates to give the impression that all
262 pages start at (0,0)*/
266 gfxline_t* current_text_stroke;
267 gfxline_t* current_text_clip;
268 gfxfont_t* current_gfxfont;
269 FontInfo*current_fontinfo;
270 gfxmatrix_t current_font_matrix;
277 int config_use_fontconfig;
278 int config_break_on_warning;
279 int config_remapunicode;
280 int config_transparent;
281 int config_extrafontdata;
282 int config_convertgradients;
283 int config_optimize_polygons;
284 double config_fontquality;
291 class GFXGlobalParams: public GlobalParams {
295 virtual DisplayFontParam *getDisplayFont(GString *fontName);
298 #endif //__gfxoutputdev_h__