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;
34 typedef struct _feature
40 void addGlobalFont(const char*filename);
41 void addGlobalLanguageDir(const char*dir);
42 void addGlobalFontDir(const char*dirname);
44 class GFXOutputDev: public CommonOutputDev {
48 GFXOutputDev(InfoOutputDev*info, PDFDoc*doc);
49 virtual ~GFXOutputDev() ;
51 virtual void setDevice(gfxdevice_t*dev);
52 virtual void setMove(int x,int y);
53 virtual void setClip(int x1,int y1,int x2,int y2);
54 virtual void setParameter(const char*key, const char*value);
57 virtual void startPage(int pageNum, GfxState *state, double x1, double y1, double x2, double y2) ;
58 virtual void endPage();
60 //----- get info about output device
62 // Does this device use upside-down coordinates?
63 // (Upside-down means (0,0) is the top left corner of the page.)
64 virtual GBool upsideDown();
66 // Does this device use drawChar() or drawString()?
67 virtual GBool useDrawChar();
69 virtual GBool interpretType3Chars();
71 //virtual GBool useShadedFills() { return gTrue; }
74 virtual void processLink(Link *link, Catalog *catalog);
76 //----- save/restore graphics state
77 virtual void saveState(GfxState *state) ;
78 virtual void restoreState(GfxState *state) ;
80 //----- update graphics state
82 virtual void updateLineDash(GfxState *state);
83 virtual void updateFont(GfxState *state);
84 virtual void updateFontMatrix(GfxState *state);
85 virtual void updateFillColor(GfxState *state);
86 virtual void updateStrokeColor(GfxState *state);
87 virtual void updateLineWidth(GfxState *state);
88 virtual void updateLineJoin(GfxState *state);
89 virtual void updateLineCap(GfxState *state);
90 virtual void updateFillOpacity(GfxState *state);
91 virtual void updateStrokeOpacity(GfxState *state);
92 virtual void updateFillOverprint(GfxState *state);
93 virtual void updateStrokeOverprint(GfxState *state);
94 virtual void updateTransfer(GfxState *state);
96 virtual void updateAll(GfxState *state)
99 updateFillColor(state);
100 updateStrokeColor(state);
101 updateLineWidth(state);
102 updateLineJoin(state);
103 updateLineCap(state);
106 //----- path painting
107 virtual void stroke(GfxState *state) ;
108 virtual void fill(GfxState *state) ;
109 virtual void eoFill(GfxState *state) ;
111 //----- path clipping
112 virtual void clip(GfxState *state) ;
113 virtual void eoClip(GfxState *state) ;
114 virtual void clipToStrokePath(GfxState *state);
117 virtual GBool useTilingPatternFill();
118 virtual GBool useShadedFills();
120 #if (xpdfMajorVersion < 3) || (xpdfMinorVersion < 2) || (xpdfUpdateVersion < 7)
121 virtual void tilingPatternFill(GfxState *state, Object *str,
122 int paintType, Dict *resDict,
123 double *mat, double *bbox,
124 int x0, int y0, int x1, int y1,
125 double xStep, double yStep);
127 virtual void tilingPatternFill(GfxState *state, Gfx *gfx, Object *str,
128 int paintType, Dict *resDict,
129 double *mat, double *bbox,
130 int x0, int y0, int x1, int y1,
131 double xStep, double yStep);
133 virtual GBool functionShadedFill(GfxState *state,
134 GfxFunctionShading *shading);
135 virtual GBool axialShadedFill(GfxState *state, GfxAxialShading *shading);
136 virtual GBool radialShadedFill(GfxState *state, GfxRadialShading *shading);
139 virtual void beginString(GfxState *state, GString *s) ;
140 virtual void endString(GfxState *state) ;
141 virtual void endTextObject(GfxState *state);
142 virtual void drawChar(GfxState *state, double x, double y,
143 double dx, double dy,
144 double originX, double originY,
145 CharCode code, int nBytes, Unicode *u, int uLen);
147 //----- image drawing
148 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
149 int width, int height, GBool invert,
151 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
152 int width, int height, GfxImageColorMap *colorMap,
153 int *maskColors, GBool inlineImg);
154 virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
155 int width, int height,
156 GfxImageColorMap *colorMap,
157 Stream *maskStr, int maskWidth, int maskHeight,
159 virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
160 int width, int height,
161 GfxImageColorMap *colorMap,
163 int maskWidth, int maskHeight,
164 GfxImageColorMap *maskColorMap);
166 //----- transparency groups and soft masks (xpdf >= ~ 3.01.16)
167 virtual void beginTransparencyGroup(GfxState *state, double *bbox,
168 GfxColorSpace *blendingColorSpace,
169 GBool isolated, GBool knockout,
171 virtual void endTransparencyGroup(GfxState *state);
172 virtual void paintTransparencyGroup(GfxState *state, double *bbox);
173 virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *backdropColor);
174 virtual void clearSoftMask(GfxState *state);
177 virtual GBool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen);
178 virtual void endType3Char(GfxState *state);
180 virtual void type3D0(GfxState *state, double wx, double wy);
181 virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury);
183 virtual void preparePage(int pdfpage, int outputpage);
185 char* searchForSuitableFont(GfxFont*gfxFont);
189 virtual GBool useDrawForm();
190 virtual void drawForm(Ref id);
191 virtual GBool needNonText();
193 //virtual void dump();
194 //virtual void beginStringOp(GfxState *state);
195 //virtual void drawString(GfxState *state, GString *s);
196 //virtual void endStringOp(GfxState *state);
197 //virtual GBool getVectorAntialias() { return gFalse; }
198 //virtual void setVectorAntialias(GBool vaa) {}
199 //virtual void psXObject(Stream *psStream, Stream *level1Stream) {}
202 gfxline_t* gfxPath_to_gfxline(GfxState*state, GfxPath*path, int closed, int user_movex, int user_movey);
204 void transformXY(GfxState*state, double x, double y, double*nx, double*ny);
206 void drawGeneralImage(GfxState *state, Object *ref, Stream *str,
207 int width, int height, GfxImageColorMap*colorMap, GBool invert,
208 GBool inlineImg, int mask, int *maskColors,
209 Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GfxImageColorMap*maskColorMap);
210 int setGfxFont(char*id, char*name, char*filename, double maxSize, CharCodeToUnicode*ctu);
211 void strokeGfxline(GfxState *state, gfxline_t*line, int flags);
212 void clipToGfxLine(GfxState *state, gfxline_t*line);
213 void fillGfxLine(GfxState *state, gfxline_t*line);
215 void showfeature(const char*feature,char fully, char warn);
216 void warnfeature(const char*feature,char fully);
217 void infofeature(const char*feature);
219 feature_t*featurewarnings;
221 char outer_clip_box; //whether the page clip box is still on
223 gfxfontlist_t*gfxfontlist;
225 GBool do_interpretType3Chars;
228 GFXOutputState states[64];
236 char* searchFont(const char*name);
237 char* substituteFont(GfxFont*gfxFont, char*oldname);
238 char* writeEmbeddedFontToFile(XRef*ref, GfxFont*font);
240 int textmodeinfo; // did we write "Text will be rendered as polygon" yet?
241 int jpeginfo; // did we write "File contains jpegs" yet?
242 int pbminfo; // did we write "File contains jpegs" yet?
243 int linkinfo; // did we write "File contains links" yet?
245 int type3active; // are we between beginType3()/endType3()?
251 const char* substitutetarget[256];
252 const char* substitutesource[256];
255 int user_movex,user_movey;
256 int user_clipx1,user_clipx2,user_clipy1,user_clipy2;
258 /* upper left corner of clipping rectangle (cropbox)- needs to be
259 added to all drawing coordinates to give the impression that all
260 pages start at (0,0)*/
264 gfxline_t* current_text_stroke;
265 gfxline_t* current_text_clip;
266 gfxfont_t* current_gfxfont;
267 FontInfo*current_fontinfo;
268 gfxmatrix_t current_font_matrix;
275 int config_use_fontconfig;
276 int config_break_on_warning;
277 int config_remapunicode;
278 int config_transparent;
279 int config_extrafontdata;
280 int config_convertgradients;
281 int config_optimize_polygons;
282 double config_fontquality;
289 class GFXGlobalParams: public GlobalParams {
293 virtual DisplayFontParam *getDisplayFont(GString *fontName);
296 #endif //__gfxoutputdev_h__