1 #ifndef __gfxoutputdev_h__
2 #define __gfxoutputdev_h__
4 #include "../gfxdevice.h"
5 #include "../gfxsource.h"
7 #include "InfoOutputDev.h"
10 typedef struct _fontlist
17 class GFXOutputState {
24 typedef struct _parameter
28 struct _parameter*next;
31 void addGlobalFont(char*filename);
32 void addGlobalLanguageDir(char*dir);
33 void addGlobalFontDir(char*dirname);
35 class GFXOutputDev: public OutputDev {
40 GFXOutputDev(parameter_t*p);
41 void setDevice(gfxdevice_t*dev);
44 virtual ~GFXOutputDev() ;
46 void setMove(int x,int y);
47 void setClip(int x1,int y1,int x2,int y2);
49 void setInfo(InfoOutputDev*info) {this->info = info;}
52 void startFrame(int width, int height);
54 virtual void startPage(int pageNum, GfxState *state, double x1, double y1, double x2, double y2) ;
58 //----- get info about output device
60 // Does this device use upside-down coordinates?
61 // (Upside-down means (0,0) is the top left corner of the page.)
62 virtual GBool upsideDown();
64 // Does this device use drawChar() or drawString()?
65 virtual GBool useDrawChar();
67 virtual GBool interpretType3Chars();
69 //virtual GBool useShadedFills() { return gTrue; }
71 //----- initialization and control
73 void setXRef(PDFDoc*doc, XRef *xref);
76 virtual void drawLink(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 updateFont(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);
91 virtual void updateAll(GfxState *state)
94 updateFillColor(state);
95 updateStrokeColor(state);
96 updateLineWidth(state);
97 updateLineJoin(state);
101 //----- path painting
102 virtual void stroke(GfxState *state) ;
103 virtual void fill(GfxState *state) ;
104 virtual void eoFill(GfxState *state) ;
106 //----- path clipping
107 virtual void clip(GfxState *state) ;
108 virtual void eoClip(GfxState *state) ;
111 virtual void beginString(GfxState *state, GString *s) ;
112 virtual void endString(GfxState *state) ;
113 virtual void endTextObject(GfxState *state);
114 virtual void drawChar(GfxState *state, double x, double y,
115 double dx, double dy,
116 double originX, double originY,
117 CharCode code, int nBytes, Unicode *u, int uLen);
119 //----- image drawing
120 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
121 int width, int height, GBool invert,
123 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
124 int width, int height, GfxImageColorMap *colorMap,
125 int *maskColors, GBool inlineImg);
126 virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
127 int width, int height,
128 GfxImageColorMap *colorMap,
129 Stream *maskStr, int maskWidth, int maskHeight,
131 virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
132 int width, int height,
133 GfxImageColorMap *colorMap,
135 int maskWidth, int maskHeight,
136 GfxImageColorMap *maskColorMap);
138 virtual GBool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen);
139 virtual void endType3Char(GfxState *state);
141 virtual void type3D0(GfxState *state, double wx, double wy);
142 virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury);
144 void preparePage(int pdfpage, int outputpage);
146 char* searchForSuitableFont(GfxFont*gfxFont);
151 void drawGeneralImage(GfxState *state, Object *ref, Stream *str,
152 int width, int height, GfxImageColorMap*colorMap, GBool invert,
153 GBool inlineImg, int mask, int *maskColors,
154 Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GfxImageColorMap*maskColorMap);
155 int setGfxFont(char*id, char*name, char*filename, double quality);
156 void strokeGfxline(GfxState *state, gfxline_t*line);
157 void clipToGfxLine(GfxState *state, gfxline_t*line);
158 void fillGfxLine(GfxState *state, gfxline_t*line);
160 char outer_clip_box; //whether the page clip box is still on
163 GFXOutputState states[64];
171 char* searchFont(char*name);
172 char* substituteFont(GfxFont*gfxFont, char*oldname);
173 char* writeEmbeddedFontToFile(XRef*ref, GfxFont*font);
175 int textmodeinfo; // did we write "Text will be rendered as polygon" yet?
176 int jpeginfo; // did we write "File contains jpegs" yet?
177 int pbminfo; // did we write "File contains jpegs" yet?
178 int linkinfo; // did we write "File contains links" yet?
179 int ttfinfo; // did we write "File contains TrueType Fonts" yet?
180 int gradientinfo; // did we write "File contains Gradients yet?
182 int type3active; // are we between beginType3()/endType3()?
188 char* substitutetarget[256];
189 char* substitutesource[256];
192 /* upper left corner of clipping rectangle (cropbox)- needs to be
193 added to all drawing coordinates to give the impression that all
194 pages start at (0,0)*/
195 int clipmovex,clipmovey;
197 int user_movex,user_movey;
198 int user_clipx1,user_clipx2,user_clipy1,user_clipy2;
200 gfxline_t* current_text_stroke;
201 gfxline_t* current_text_clip;
202 char* current_font_id;
203 gfxfont_t* current_gfxfont;
204 gfxmatrix_t current_font_matrix;
206 fontlist_t* fontlist;
214 int config_use_fontconfig;
216 parameter_t*parameters;
219 #endif //__gfxoutputdev_h__