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 // Is this device able to draw gradients?
65 virtual GBool useGradients() = 0;
67 // Does this device use beginType3Char/endType3Char? Otherwise,
68 // text in Type 3 fonts will be drawn with drawChar/drawString.
69 virtual GBool interpretType3Chars() = 0;
71 // Does this device need non-text content?
72 virtual GBool needNonText() { return gTrue; }
74 //----- initialization and control
76 // Set default transform matrix.
77 virtual void setDefaultCTM(double *ctm);
80 virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {}
83 virtual void endPage() {}
85 // Dump page contents to display.
86 virtual void dump() {}
88 //----- coordinate conversion
90 // Convert between device and user coordinates.
91 virtual void cvtDevToUser(double dx, double dy, double *ux, double *uy);
92 virtual void cvtUserToDev(double ux, double uy, int *dx, int *dy);
94 double *getDefCTM() { return defCTM; }
95 double *getDefICTM() { return defICTM; }
98 virtual void drawLink(Link *link, Catalog *catalog) {}
100 //----- save/restore graphics state
101 virtual void saveState(GfxState *state) {}
102 virtual void restoreState(GfxState *state) {}
104 //----- update graphics state
105 virtual void updateAll(GfxState *state);
106 virtual void updateCTM(GfxState *state, double m11, double m12,
107 double m21, double m22, double m31, double m32) {}
108 virtual void updateLineDash(GfxState *state) {}
109 virtual void updateFlatness(GfxState *state) {}
110 virtual void updateLineJoin(GfxState *state) {}
111 virtual void updateLineCap(GfxState *state) {}
112 virtual void updateMiterLimit(GfxState *state) {}
113 virtual void updateLineWidth(GfxState *state) {}
114 virtual void updateFillColorSpace(GfxState *state) {}
115 virtual void updateStrokeColorSpace(GfxState *state) {}
116 virtual void updateFillColor(GfxState *state) {}
117 virtual void updateStrokeColor(GfxState *state) {}
118 virtual void updateBlendMode(GfxState *state) {}
119 virtual void updateFillOpacity(GfxState *state) {}
120 virtual void updateStrokeOpacity(GfxState *state) {}
121 virtual void updateFillOverprint(GfxState *state) {}
122 virtual void updateStrokeOverprint(GfxState *state) {}
124 //----- update text state
125 virtual void updateFont(GfxState *state) {}
126 virtual void updateTextMat(GfxState *state) {}
127 virtual void updateCharSpace(GfxState *state) {}
128 virtual void updateRender(GfxState *state) {}
129 virtual void updateRise(GfxState *state) {}
130 virtual void updateWordSpace(GfxState *state) {}
131 virtual void updateHorizScaling(GfxState *state) {}
132 virtual void updateTextPos(GfxState *state) {}
133 virtual void updateTextShift(GfxState *state, double shift) {}
135 //----- path painting
136 virtual void stroke(GfxState *state) {}
137 virtual void fill(GfxState *state) {}
138 virtual void eoFill(GfxState *state) {}
139 virtual void tilingPatternFill(GfxState *state, Object *str,
140 int paintType, Dict *resDict,
141 double *mat, double *bbox,
142 int x0, int y0, int x1, int y1,
143 double xStep, double yStep) {}
144 virtual void functionShadedFill(GfxState *state,
145 GfxFunctionShading *shading) {}
146 virtual void axialShadedFill(GfxState *state, GfxAxialShading *shading) {}
147 virtual void radialShadedFill(GfxState *state, GfxRadialShading *shading) {}
149 //----- path clipping
150 virtual void clip(GfxState *state) {}
151 virtual void eoClip(GfxState *state) {}
154 virtual void beginStringOp(GfxState *state) {}
155 virtual void endStringOp(GfxState *state) {}
156 virtual void beginString(GfxState *state, GString *s) {}
157 virtual void endString(GfxState *state) {}
158 virtual void drawChar(GfxState *state, double x, double y,
159 double dx, double dy,
160 double originX, double originY,
161 CharCode code, int nBytes, Unicode *u, int uLen) {}
162 virtual void drawString(GfxState *state, GString *s) {}
163 virtual GBool beginType3Char(GfxState *state, double x, double y,
164 double dx, double dy,
165 CharCode code, Unicode *u, int uLen);
166 virtual void endType3Char(GfxState *state) {}
167 virtual void endTextObject(GfxState *state) {}
169 //----- image drawing
170 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
171 int width, int height, GBool invert,
173 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
174 int width, int height, GfxImageColorMap *colorMap,
175 int *maskColors, GBool inlineImg);
176 virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
177 int width, int height,
178 GfxImageColorMap *colorMap,
179 Stream *maskStr, int maskWidth, int maskHeight,
181 virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
182 int width, int height,
183 GfxImageColorMap *colorMap,
185 int maskWidth, int maskHeight,
186 GfxImageColorMap *maskColorMap);
189 //----- OPI functions
190 virtual void opiBegin(GfxState *state, Dict *opiDict);
191 virtual void opiEnd(GfxState *state, Dict *opiDict);
194 //----- Type 3 font operators
195 virtual void type3D0(GfxState *state, double wx, double wy) {}
196 virtual void type3D1(GfxState *state, double wx, double wy,
197 double llx, double lly, double urx, double ury) {}
199 //----- PostScript XObjects
200 virtual void psXObject(Stream *psStream, Stream *level1Stream) {}
204 double defCTM[6]; // default coordinate transform matrix
205 double defICTM[6]; // inverse of default CTM