1 #ifndef __gfxoutputdev_h__
2 #define __gfxoutputdev_h__
4 #include "../gfxdevice.h"
5 #include "../gfxsource.h"
6 #include "../gfxtools.h"
8 #include "InfoOutputDev.h"
10 #include "GlobalParams.h"
11 #include "CommonOutputDev.h"
13 class GFXOutputState {
18 char transparencygroup;
27 gfxresult_t* grouprecording; // for transparency groups
28 gfxresult_t* softmaskrecording; // for soft masks
30 gfxdevice_t* olddevice;
39 typedef struct _feature
45 void addGlobalFont(const char*filename);
46 void addGlobalLanguageDir(const char*dir);
47 void addGlobalFontDir(const char*dirname);
49 class GFXOutputGlobals {
51 feature_t*featurewarnings;
53 int textmodeinfo; // did we write "Text will be rendered as polygon" yet?
54 int jpeginfo; // did we write "File contains jpegs" yet?
55 int pbminfo; // did we write "File contains jpegs" yet?
56 int linkinfo; // did we write "File contains links" yet?
62 class GFXOutputDev: public CommonOutputDev {
66 GFXOutputDev(InfoOutputDev*info, PDFDoc*doc);
67 virtual ~GFXOutputDev() ;
69 virtual void setDevice(gfxdevice_t*dev);
70 virtual void setMove(int x,int y);
71 virtual void setClip(int x1,int y1,int x2,int y2);
72 virtual void setParameter(const char*key, const char*value);
75 virtual void startPage(int pageNum, GfxState *state);
76 virtual void endPage();
78 //----- get info about output device
80 // Does this device use upside-down coordinates?
81 // (Upside-down means (0,0) is the top left corner of the page.)
82 virtual GBool upsideDown();
84 // Does this device use drawChar() or drawString()?
85 virtual GBool useDrawChar();
87 virtual GBool interpretType3Chars();
89 //virtual GBool useShadedFills() { return gTrue; }
92 virtual void processLink(Link *link, Catalog *catalog);
94 //----- save/restore graphics state
95 virtual void saveState(GfxState *state) ;
96 virtual void restoreState(GfxState *state) ;
98 //----- update graphics state
100 virtual void updateLineDash(GfxState *state);
101 virtual void updateFont(GfxState *state);
102 virtual void updateFontMatrix(GfxState *state);
103 virtual void updateFillColor(GfxState *state);
104 virtual void updateStrokeColor(GfxState *state);
105 virtual void updateLineWidth(GfxState *state);
106 virtual void updateLineJoin(GfxState *state);
107 virtual void updateLineCap(GfxState *state);
108 virtual void updateFillOpacity(GfxState *state);
109 virtual void updateStrokeOpacity(GfxState *state);
110 virtual void updateFillOverprint(GfxState *state);
111 virtual void updateStrokeOverprint(GfxState *state);
112 virtual void updateTransfer(GfxState *state);
114 virtual void updateAll(GfxState *state)
117 updateFillColor(state);
118 updateStrokeColor(state);
119 updateLineWidth(state);
120 updateLineJoin(state);
121 updateLineCap(state);
124 //----- path painting
125 virtual void stroke(GfxState *state) ;
126 virtual void fill(GfxState *state) ;
127 virtual void eoFill(GfxState *state) ;
129 //----- path clipping
130 virtual void clip(GfxState *state) ;
131 virtual void eoClip(GfxState *state) ;
132 virtual void clipToStrokePath(GfxState *state);
135 virtual GBool useTilingPatternFill();
136 virtual GBool useShadedFills();
138 virtual POPPLER_TILING_PATERN_RETURN tilingPatternFill(GfxState *state,
139 POPPLER_TILING_PATERN_GFX
141 int paintType, Dict *resDict,
142 double *mat, double *bbox,
143 int x0, int y0, int x1, int y1,
144 double xStep, double yStep);
145 virtual GBool functionShadedFill(GfxState *state,
146 GfxFunctionShading *shading);
147 virtual GBool axialShadedFill(GfxState *state, GfxAxialShading *shading);
148 virtual GBool radialShadedFill(GfxState *state, GfxRadialShading *shading);
151 virtual void beginString(GfxState *state, GString *s) ;
152 virtual void endString(GfxState *state) ;
153 virtual void endTextObject(GfxState *state);
154 virtual void drawChar(GfxState *state, double x, double y,
155 double dx, double dy,
156 double originX, double originY,
157 CharCode code, int nBytes, Unicode *u, int uLen);
159 //----- image drawing
160 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
161 int width, int height, GBool invert,
163 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
164 int width, int height, GfxImageColorMap *colorMap,
165 int *maskColors, GBool inlineImg);
166 virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
167 int width, int height,
168 GfxImageColorMap *colorMap,
169 Stream *maskStr, int maskWidth, int maskHeight,
171 virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
172 int width, int height,
173 GfxImageColorMap *colorMap,
175 int maskWidth, int maskHeight,
176 GfxImageColorMap *maskColorMap);
178 //----- transparency groups and soft masks (xpdf >= ~ 3.01.16)
179 virtual void beginTransparencyGroup(GfxState *state, double *bbox,
180 GfxColorSpace *blendingColorSpace,
181 GBool isolated, GBool knockout,
183 virtual void endTransparencyGroup(GfxState *state);
184 virtual void paintTransparencyGroup(GfxState *state, double *bbox);
185 virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *backdropColor);
186 virtual void clearSoftMask(GfxState *state);
189 virtual GBool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen);
190 virtual void endType3Char(GfxState *state);
192 virtual void type3D0(GfxState *state, double wx, double wy);
193 virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury);
195 char* searchForSuitableFont(GfxFont*gfxFont);
199 virtual GBool useDrawForm();
200 virtual void drawForm(Ref id);
201 virtual GBool needNonText();
203 //virtual void dump();
204 //virtual void beginStringOp(GfxState *state);
205 //virtual void drawString(GfxState *state, GString *s);
206 //virtual void endStringOp(GfxState *state);
207 //virtual GBool getVectorAntialias() { return gFalse; }
208 //virtual void setVectorAntialias(GBool vaa) {}
209 //virtual void psXObject(Stream *psStream, Stream *level1Stream) {}
211 virtual void setPageMap(int*pagemap, int pagemap_len);
214 gfxline_t* gfxPath_to_gfxline(GfxState*state, GfxPath*path, int closed, int user_movex, int user_movey);
216 void transformXY(GfxState*state, double x, double y, double*nx, double*ny);
218 void drawGeneralImage(GfxState *state, Object *ref, Stream *str,
219 int width, int height, GfxImageColorMap*colorMap, GBool invert,
220 GBool inlineImg, int mask, int *maskColors,
221 Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GfxImageColorMap*maskColorMap);
223 void strokeGfxline(GfxState *state, gfxline_t*line, int flags);
224 void clipToGfxLine(GfxState *state, gfxline_t*line, char evenodd);
225 void fillGfxLine(GfxState *state, gfxline_t*line, char evenodd);
227 gfxfont_t* createGfxFont(GfxFont*xpdffont, FontInfo*src);
229 void showfeature(const char*feature,char fully, char warn);
230 void warnfeature(const char*feature,char fully);
231 void infofeature(const char*feature);
233 char* searchFont(const char*name);
234 char* substituteFont(GfxFont*gfxFont, char*oldname);
235 char* writeEmbeddedFontToFile(XRef*ref, GfxFont*font);
237 /* for page mapping */
243 char outer_clip_box; //whether the page clip box is still on
245 GFXOutputState states[64];
251 int type3active; // are we between beginType3()/endType3()?
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;
270 gfxfont_t* last_char_gfxfont;
274 char last_char_was_space;
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_disable_polygon_conversion;
286 int config_drawonlyshapes;
287 int config_detectspaces;
289 char* config_linkdatafile;
290 double config_fontquality;
293 class GFXGlobalParams: public GlobalParams {
297 virtual DisplayFontParam *getDisplayFont(GString *fontName);
300 #endif //__gfxoutputdev_h__