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;
40 typedef struct _feature
46 void addGlobalFont(const char*filename);
47 void addGlobalLanguageDir(const char*dir);
48 void addGlobalFontDir(const char*dirname);
50 class GFXOutputGlobals {
52 feature_t*featurewarnings;
54 int textmodeinfo; // did we write "Text will be rendered as polygon" yet?
55 int jpeginfo; // did we write "File contains jpegs" yet?
56 int pbminfo; // did we write "File contains jpegs" yet?
57 int linkinfo; // did we write "File contains links" yet?
63 class GFXOutputDev: public CommonOutputDev {
67 GFXOutputDev(InfoOutputDev*info, PDFDoc*doc);
68 virtual ~GFXOutputDev() ;
70 virtual void setDevice(gfxdevice_t*dev);
71 virtual void setMove(int x,int y);
72 virtual void setClip(int x1,int y1,int x2,int y2);
73 virtual void setParameter(const char*key, const char*value);
76 virtual void startPage(int pageNum, GfxState *state, double x1, double y1, double x2, double y2) ;
77 virtual void endPage();
79 //----- get info about output device
81 // Does this device use upside-down coordinates?
82 // (Upside-down means (0,0) is the top left corner of the page.)
83 virtual GBool upsideDown();
85 // Does this device use drawChar() or drawString()?
86 virtual GBool useDrawChar();
88 virtual GBool interpretType3Chars();
90 //virtual GBool useShadedFills() { return gTrue; }
93 virtual void processLink(Link *link, Catalog *catalog);
95 //----- save/restore graphics state
96 virtual void saveState(GfxState *state) ;
97 virtual void restoreState(GfxState *state) ;
99 //----- update graphics state
101 virtual void updateLineDash(GfxState *state);
102 virtual void updateFont(GfxState *state);
103 virtual void updateFontMatrix(GfxState *state);
104 virtual void updateFillColor(GfxState *state);
105 virtual void updateStrokeColor(GfxState *state);
106 virtual void updateLineWidth(GfxState *state);
107 virtual void updateLineJoin(GfxState *state);
108 virtual void updateLineCap(GfxState *state);
109 virtual void updateFillOpacity(GfxState *state);
110 virtual void updateStrokeOpacity(GfxState *state);
111 virtual void updateFillOverprint(GfxState *state);
112 virtual void updateStrokeOverprint(GfxState *state);
113 virtual void updateTransfer(GfxState *state);
115 virtual void updateAll(GfxState *state)
118 updateFillColor(state);
119 updateStrokeColor(state);
120 updateLineWidth(state);
121 updateLineJoin(state);
122 updateLineCap(state);
125 //----- path painting
126 virtual void stroke(GfxState *state) ;
127 virtual void fill(GfxState *state) ;
128 virtual void eoFill(GfxState *state) ;
130 //----- path clipping
131 virtual void clip(GfxState *state) ;
132 virtual void eoClip(GfxState *state) ;
133 virtual void clipToStrokePath(GfxState *state);
136 virtual GBool useTilingPatternFill();
137 virtual GBool useShadedFills();
139 #if (xpdfMajorVersion < 3) || (xpdfMinorVersion < 2) || (xpdfUpdateVersion < 7)
140 virtual void tilingPatternFill(GfxState *state, Object *str,
141 int paintType, Dict *resDict,
142 double *mat, double *bbox,
143 int x0, int y0, int x1, int y1,
144 double xStep, double yStep);
146 virtual void tilingPatternFill(GfxState *state, Gfx *gfx, Object *str,
147 int paintType, Dict *resDict,
148 double *mat, double *bbox,
149 int x0, int y0, int x1, int y1,
150 double xStep, double yStep);
152 virtual GBool functionShadedFill(GfxState *state,
153 GfxFunctionShading *shading);
154 virtual GBool axialShadedFill(GfxState *state, GfxAxialShading *shading);
155 virtual GBool radialShadedFill(GfxState *state, GfxRadialShading *shading);
158 virtual void beginString(GfxState *state, GString *s) ;
159 virtual void endString(GfxState *state) ;
160 virtual void endTextObject(GfxState *state);
161 virtual void drawChar(GfxState *state, double x, double y,
162 double dx, double dy,
163 double originX, double originY,
164 CharCode code, int nBytes, Unicode *u, int uLen);
166 //----- image drawing
167 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
168 int width, int height, GBool invert,
170 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
171 int width, int height, GfxImageColorMap *colorMap,
172 int *maskColors, GBool inlineImg);
173 virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
174 int width, int height,
175 GfxImageColorMap *colorMap,
176 Stream *maskStr, int maskWidth, int maskHeight,
178 virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
179 int width, int height,
180 GfxImageColorMap *colorMap,
182 int maskWidth, int maskHeight,
183 GfxImageColorMap *maskColorMap);
185 //----- transparency groups and soft masks (xpdf >= ~ 3.01.16)
186 virtual void beginTransparencyGroup(GfxState *state, double *bbox,
187 GfxColorSpace *blendingColorSpace,
188 GBool isolated, GBool knockout,
190 virtual void endTransparencyGroup(GfxState *state);
191 virtual void paintTransparencyGroup(GfxState *state, double *bbox);
192 virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *backdropColor);
193 virtual void clearSoftMask(GfxState *state);
196 virtual GBool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen);
197 virtual void endType3Char(GfxState *state);
199 virtual void type3D0(GfxState *state, double wx, double wy);
200 virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury);
202 char* searchForSuitableFont(GfxFont*gfxFont);
206 virtual GBool useDrawForm();
207 virtual void drawForm(Ref id);
208 virtual GBool needNonText();
210 //virtual void dump();
211 //virtual void beginStringOp(GfxState *state);
212 //virtual void drawString(GfxState *state, GString *s);
213 //virtual void endStringOp(GfxState *state);
214 //virtual GBool getVectorAntialias() { return gFalse; }
215 //virtual void setVectorAntialias(GBool vaa) {}
216 //virtual void psXObject(Stream *psStream, Stream *level1Stream) {}
218 virtual void setPageMap(int*pagemap, int pagemap_len);
221 gfxline_t* gfxPath_to_gfxline(GfxState*state, GfxPath*path, int closed, int user_movex, int user_movey);
223 void transformXY(GfxState*state, double x, double y, double*nx, double*ny);
225 void drawGeneralImage(GfxState *state, Object *ref, Stream *str,
226 int width, int height, GfxImageColorMap*colorMap, GBool invert,
227 GBool inlineImg, int mask, int *maskColors,
228 Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GfxImageColorMap*maskColorMap);
230 void strokeGfxline(GfxState *state, gfxline_t*line, int flags);
231 void clipToGfxLine(GfxState *state, gfxline_t*line, char evenodd);
232 void fillGfxLine(GfxState *state, gfxline_t*line, char evenodd);
234 gfxfont_t* createGfxFont(GfxFont*xpdffont, FontInfo*src);
236 void showfeature(const char*feature,char fully, char warn);
237 void warnfeature(const char*feature,char fully);
238 void infofeature(const char*feature);
240 char* searchFont(const char*name);
241 char* substituteFont(GfxFont*gfxFont, char*oldname);
242 char* writeEmbeddedFontToFile(XRef*ref, GfxFont*font);
244 /* for page mapping */
250 char outer_clip_box; //whether the page clip box is still on
252 GFXOutputState states[64];
258 int type3active; // are we between beginType3()/endType3()?
262 int user_movex,user_movey;
263 int user_clipx1,user_clipx2,user_clipy1,user_clipy2;
265 /* upper left corner of clipping rectangle (cropbox)- needs to be
266 added to all drawing coordinates to give the impression that all
267 pages start at (0,0)*/
271 gfxline_t* current_text_stroke;
272 gfxline_t* current_text_clip;
273 gfxfont_t* current_gfxfont;
274 FontInfo*current_fontinfo;
275 gfxmatrix_t current_font_matrix;
277 gfxfont_t* last_char_gfxfont;
281 char last_char_was_space;
284 int config_use_fontconfig;
285 int config_break_on_warning;
286 int config_remapunicode;
287 int config_transparent;
288 int config_extrafontdata;
289 int config_convertgradients;
290 int config_disable_polygon_conversion;
293 int config_drawonlyshapes;
294 int config_detectspaces;
295 char* config_linkdatafile;
296 double config_fontquality;
299 class GFXGlobalParams: public GlobalParams {
303 virtual DisplayFontParam *getDisplayFont(GString *fontName);
306 #endif //__gfxoutputdev_h__