1 #ifndef __gfxoutputdev_h__
2 #define __gfxoutputdev_h__
4 #include "../gfxdevice.h"
5 #include "../gfxsource.h"
7 #include "InfoOutputDev.h"
10 typedef struct _fontlist
18 class GFXOutputState {
25 typedef struct _parameter
29 struct _parameter*next;
32 void addGlobalFont(char*filename);
33 void addGlobalLanguageDir(char*dir);
34 void addGlobalFontDir(char*dirname);
36 class GFXOutputDev: public OutputDev {
41 GFXOutputDev::GFXOutputDev(parameter_t*p);
42 void setDevice(gfxdevice_t*dev);
45 virtual ~GFXOutputDev() ;
47 void setMove(int x,int y);
48 void setClip(int x1,int y1,int x2,int y2);
50 void setInfo(InfoOutputDev*info) {this->info = info;}
53 void startFrame(int width, int height);
55 virtual void startPage(int pageNum, GfxState *state, double x1, double y1, double x2, double y2) ;
59 //----- get info about output device
61 // Does this device use upside-down coordinates?
62 // (Upside-down means (0,0) is the top left corner of the page.)
63 virtual GBool upsideDown();
65 // Does this device use drawChar() or drawString()?
66 virtual GBool useDrawChar();
68 virtual GBool interpretType3Chars();
70 //virtual GBool useShadedFills() { return gTrue; }
72 //----- initialization and control
74 void setXRef(PDFDoc*doc, XRef *xref);
77 virtual void drawLink(Link *link, Catalog *catalog) ;
79 //----- save/restore graphics state
80 virtual void saveState(GfxState *state) ;
81 virtual void restoreState(GfxState *state) ;
83 //----- update graphics state
85 virtual void updateFont(GfxState *state);
86 virtual void updateFillColor(GfxState *state);
87 virtual void updateStrokeColor(GfxState *state);
88 virtual void updateLineWidth(GfxState *state);
89 virtual void updateLineJoin(GfxState *state);
90 virtual void updateLineCap(GfxState *state);
92 virtual void updateAll(GfxState *state)
95 updateFillColor(state);
96 updateStrokeColor(state);
97 updateLineWidth(state);
98 updateLineJoin(state);
102 //----- path painting
103 virtual void stroke(GfxState *state) ;
104 virtual void fill(GfxState *state) ;
105 virtual void eoFill(GfxState *state) ;
107 //----- path clipping
108 virtual void clip(GfxState *state) ;
109 virtual void eoClip(GfxState *state) ;
112 virtual void beginString(GfxState *state, GString *s) ;
113 virtual void endString(GfxState *state) ;
114 virtual void endTextObject(GfxState *state);
115 virtual void drawChar(GfxState *state, double x, double y,
116 double dx, double dy,
117 double originX, double originY,
118 CharCode code, int nBytes, Unicode *u, int uLen);
120 //----- image drawing
121 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
122 int width, int height, GBool invert,
124 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
125 int width, int height, GfxImageColorMap *colorMap,
126 int *maskColors, GBool inlineImg);
127 virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
128 int width, int height,
129 GfxImageColorMap *colorMap,
130 Stream *maskStr, int maskWidth, int maskHeight,
132 virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
133 int width, int height,
134 GfxImageColorMap *colorMap,
136 int maskWidth, int maskHeight,
137 GfxImageColorMap *maskColorMap);
139 virtual GBool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen);
140 virtual void endType3Char(GfxState *state);
142 virtual void type3D0(GfxState *state, double wx, double wy);
143 virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury);
145 void preparePage(int pdfpage, int outputpage);
147 char* searchForSuitableFont(GfxFont*gfxFont);
152 void drawGeneralImage(GfxState *state, Object *ref, Stream *str,
153 int width, int height, GfxImageColorMap*colorMap, GBool invert,
154 GBool inlineImg, int mask, int *maskColors,
155 Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GfxImageColorMap*maskColorMap);
156 int setGfxFont(char*id, char*name, char*filename, double quality);
157 void strokeGfxline(GfxState *state, gfxline_t*line);
158 void clipToGfxLine(GfxState *state, gfxline_t*line);
159 void fillGfxLine(GfxState *state, gfxline_t*line);
161 char outer_clip_box; //whether the page clip box is still on
164 GFXOutputState states[64];
172 char* searchFont(char*name);
173 char* substituteFont(GfxFont*gfxFont, char*oldname);
174 char* writeEmbeddedFontToFile(XRef*ref, GfxFont*font);
176 int textmodeinfo; // did we write "Text will be rendered as polygon" yet?
177 int jpeginfo; // did we write "File contains jpegs" yet?
178 int pbminfo; // did we write "File contains jpegs" yet?
179 int linkinfo; // did we write "File contains links" yet?
180 int ttfinfo; // did we write "File contains TrueType Fonts" yet?
181 int gradientinfo; // did we write "File contains Gradients yet?
183 int type3active; // are we between beginType3()/endType3()?
189 char* substitutetarget[256];
190 char* substitutesource[256];
193 int user_movex,user_movey;
194 int user_clipx1,user_clipx2,user_clipy1,user_clipy2;
196 gfxline_t* current_text_stroke;
197 gfxline_t* current_text_clip;
198 char* current_font_id;
199 gfxfont_t* current_gfxfont;
200 gfxmatrix_t current_font_matrix;
202 fontlist_t* fontlist;
210 int config_use_fontconfig;
213 #endif //__gfxoutputdev_h__