1 //========================================================================
5 // Copyright 1996-2003 Glyph & Cog, LLC
7 //========================================================================
14 #ifdef USE_GCC_PRAGMAS
19 #include "CharTypes.h"
24 class GfxImageColorMap;
25 class GfxFunctionShading;
26 class GfxAxialShading;
27 class GfxRadialShading;
32 //------------------------------------------------------------------------
34 //------------------------------------------------------------------------
43 virtual ~OutputDev() {}
45 //----- get info about output device
47 // Does this device use upside-down coordinates?
48 // (Upside-down means (0,0) is the top left corner of the page.)
49 virtual GBool upsideDown() = 0;
51 // Does this device use drawChar() or drawString()?
52 virtual GBool useDrawChar() = 0;
54 // Does this device use tilingPatternFill()? If this returns false,
55 // tiling pattern fills will be reduced to a series of other drawing
57 virtual GBool useTilingPatternFill() { return gFalse; }
59 // Does this device use functionShadedFill(), axialShadedFill(), and
60 // radialShadedFill()? If this returns false, these shaded fills
61 // will be reduced to a series of other drawing operations.
62 virtual GBool useShadedFills() { return gFalse; }
64 // Does this device use beginType3Char/endType3Char? Otherwise,
65 // text in Type 3 fonts will be drawn with drawChar/drawString.
66 virtual GBool interpretType3Chars() = 0;
68 // Does this device need non-text content?
69 virtual GBool needNonText() { return gTrue; }
71 //----- initialization and control
73 // Set default transform matrix.
74 virtual void setDefaultCTM(double *ctm);
77 virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {}
80 virtual void endPage() {}
82 // Dump page contents to display.
83 virtual void dump() {}
85 //----- coordinate conversion
87 // Convert between device and user coordinates.
88 virtual void cvtDevToUser(double dx, double dy, double *ux, double *uy);
89 virtual void cvtUserToDev(double ux, double uy, int *dx, int *dy);
91 double *getDefCTM() { return defCTM; }
92 double *getDefICTM() { return defICTM; }
95 virtual void drawLink(Link *link, Catalog *catalog) {}
97 //----- save/restore graphics state
98 virtual void saveState(GfxState *state) {}
99 virtual void restoreState(GfxState *state) {}
101 //----- update graphics state
102 virtual void updateAll(GfxState *state);
103 virtual void updateCTM(GfxState *state, double m11, double m12,
104 double m21, double m22, double m31, double m32) {}
105 virtual void updateLineDash(GfxState *state) {}
106 virtual void updateFlatness(GfxState *state) {}
107 virtual void updateLineJoin(GfxState *state) {}
108 virtual void updateLineCap(GfxState *state) {}
109 virtual void updateMiterLimit(GfxState *state) {}
110 virtual void updateLineWidth(GfxState *state) {}
111 virtual void updateFillColorSpace(GfxState *state) {}
112 virtual void updateStrokeColorSpace(GfxState *state) {}
113 virtual void updateFillColor(GfxState *state) {}
114 virtual void updateStrokeColor(GfxState *state) {}
115 virtual void updateBlendMode(GfxState *state) {}
116 virtual void updateFillOpacity(GfxState *state) {}
117 virtual void updateStrokeOpacity(GfxState *state) {}
118 virtual void updateFillOverprint(GfxState *state) {}
119 virtual void updateStrokeOverprint(GfxState *state) {}
121 //----- update text state
122 virtual void updateFont(GfxState *state) {}
123 virtual void updateTextMat(GfxState *state) {}
124 virtual void updateCharSpace(GfxState *state) {}
125 virtual void updateRender(GfxState *state) {}
126 virtual void updateRise(GfxState *state) {}
127 virtual void updateWordSpace(GfxState *state) {}
128 virtual void updateHorizScaling(GfxState *state) {}
129 virtual void updateTextPos(GfxState *state) {}
130 virtual void updateTextShift(GfxState *state, double shift) {}
132 //----- path painting
133 virtual void stroke(GfxState *state) {}
134 virtual void fill(GfxState *state) {}
135 virtual void eoFill(GfxState *state) {}
136 virtual void tilingPatternFill(GfxState *state, Object *str,
137 int paintType, Dict *resDict,
138 double *mat, double *bbox,
139 int x0, int y0, int x1, int y1,
140 double xStep, double yStep) {}
141 virtual void functionShadedFill(GfxState *state,
142 GfxFunctionShading *shading) {}
143 virtual void axialShadedFill(GfxState *state, GfxAxialShading *shading) {}
144 virtual void radialShadedFill(GfxState *state, GfxRadialShading *shading) {}
146 //----- path clipping
147 virtual void clip(GfxState *state) {}
148 virtual void eoClip(GfxState *state) {}
151 virtual void beginStringOp(GfxState *state) {}
152 virtual void endStringOp(GfxState *state) {}
153 virtual void beginString(GfxState *state, GString *s) {}
154 virtual void endString(GfxState *state) {}
155 virtual void drawChar(GfxState *state, double x, double y,
156 double dx, double dy,
157 double originX, double originY,
158 CharCode code, int nBytes, Unicode *u, int uLen) {}
159 virtual void drawString(GfxState *state, GString *s) {}
160 virtual GBool beginType3Char(GfxState *state, double x, double y,
161 double dx, double dy,
162 CharCode code, Unicode *u, int uLen);
163 virtual void endType3Char(GfxState *state) {}
164 virtual void endTextObject(GfxState *state) {}
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);
186 //----- OPI functions
187 virtual void opiBegin(GfxState *state, Dict *opiDict);
188 virtual void opiEnd(GfxState *state, Dict *opiDict);
191 //----- Type 3 font operators
192 virtual void type3D0(GfxState *state, double wx, double wy) {}
193 virtual void type3D1(GfxState *state, double wx, double wy,
194 double llx, double lly, double urx, double ury) {}
196 //----- PostScript XObjects
197 virtual void psXObject(Stream *psStream, Stream *level1Stream) {}
201 double defCTM[6]; // default coordinate transform matrix
202 double defICTM[6]; // inverse of default CTM