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);
90 virtual void updateFillOpacity(GfxState *state);
93 virtual void updateAll(GfxState *state)
96 updateFillColor(state);
97 updateStrokeColor(state);
98 updateLineWidth(state);
99 updateLineJoin(state);
100 updateLineCap(state);
103 //----- path painting
104 virtual void stroke(GfxState *state) ;
105 virtual void fill(GfxState *state) ;
106 virtual void eoFill(GfxState *state) ;
108 //----- path clipping
109 virtual void clip(GfxState *state) ;
110 virtual void eoClip(GfxState *state) ;
113 virtual void beginString(GfxState *state, GString *s) ;
114 virtual void endString(GfxState *state) ;
115 virtual void endTextObject(GfxState *state);
116 virtual void drawChar(GfxState *state, double x, double y,
117 double dx, double dy,
118 double originX, double originY,
119 CharCode code, int nBytes, Unicode *u, int uLen);
121 //----- image drawing
122 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
123 int width, int height, GBool invert,
125 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
126 int width, int height, GfxImageColorMap *colorMap,
127 int *maskColors, GBool inlineImg);
128 virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
129 int width, int height,
130 GfxImageColorMap *colorMap,
131 Stream *maskStr, int maskWidth, int maskHeight,
133 virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
134 int width, int height,
135 GfxImageColorMap *colorMap,
137 int maskWidth, int maskHeight,
138 GfxImageColorMap *maskColorMap);
140 //----- transparency groups and soft masks (xpdf > ~ 3.01.16)
141 virtual void beginTransparencyGroup(GfxState *state, double *bbox,
142 GfxColorSpace *blendingColorSpace,
143 GBool isolated, GBool knockout,
145 virtual void endTransparencyGroup(GfxState *state);
146 virtual void paintTransparencyGroup(GfxState *state, double *bbox);
147 virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, Function *transferFunc, GfxColor *backdropColor);
148 virtual void clearSoftMask(GfxState *state);
152 virtual GBool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen);
153 virtual void endType3Char(GfxState *state);
155 virtual void type3D0(GfxState *state, double wx, double wy);
156 virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury);
158 void preparePage(int pdfpage, int outputpage);
160 char* searchForSuitableFont(GfxFont*gfxFont);
165 void drawGeneralImage(GfxState *state, Object *ref, Stream *str,
166 int width, int height, GfxImageColorMap*colorMap, GBool invert,
167 GBool inlineImg, int mask, int *maskColors,
168 Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GfxImageColorMap*maskColorMap);
169 int setGfxFont(char*id, char*name, char*filename, double quality);
170 void strokeGfxline(GfxState *state, gfxline_t*line);
171 void clipToGfxLine(GfxState *state, gfxline_t*line);
172 void fillGfxLine(GfxState *state, gfxline_t*line);
174 char outer_clip_box; //whether the page clip box is still on
177 GFXOutputState states[64];
185 char* searchFont(char*name);
186 char* substituteFont(GfxFont*gfxFont, char*oldname);
187 char* writeEmbeddedFontToFile(XRef*ref, GfxFont*font);
189 int textmodeinfo; // did we write "Text will be rendered as polygon" yet?
190 int jpeginfo; // did we write "File contains jpegs" yet?
191 int pbminfo; // did we write "File contains jpegs" yet?
192 int linkinfo; // did we write "File contains links" yet?
193 int ttfinfo; // did we write "File contains TrueType Fonts" yet?
194 int gradientinfo; // did we write "File contains Gradients yet?
196 int type3active; // are we between beginType3()/endType3()?
202 char* substitutetarget[256];
203 char* substitutesource[256];
206 /* upper left corner of clipping rectangle (cropbox)- needs to be
207 added to all drawing coordinates to give the impression that all
208 pages start at (0,0)*/
209 int clipmovex,clipmovey;
211 int user_movex,user_movey;
212 int user_clipx1,user_clipx2,user_clipy1,user_clipy2;
214 gfxline_t* current_text_stroke;
215 gfxline_t* current_text_clip;
216 char* current_font_id;
217 gfxfont_t* current_gfxfont;
218 gfxmatrix_t current_font_matrix;
220 fontlist_t* fontlist;
228 int config_use_fontconfig;
230 int transparencyGroup;
233 parameter_t*parameters;
236 #endif //__gfxoutputdev_h__