1 //========================================================================
5 // Copyright 1996-2003 Glyph & Cog, LLC
7 //========================================================================
14 #ifdef USE_GCC_PRAGMAS
19 #include "CharTypes.h"
25 class GfxImageColorMap
;
26 class GfxFunctionShading
;
27 class GfxAxialShading
;
28 class GfxRadialShading
;
36 //------------------------------------------------------------------------
38 //------------------------------------------------------------------------
47 virtual ~OutputDev() {}
49 //----- get info about output device
51 // Does this device use upside-down coordinates?
52 // (Upside-down means (0,0) is the top left corner of the page.)
53 virtual GBool
upsideDown() = 0;
55 // Does this device use drawChar() or drawString()?
56 virtual GBool
useDrawChar() = 0;
58 // Does this device use tilingPatternFill()? If this returns false,
59 // tiling pattern fills will be reduced to a series of other drawing
61 virtual GBool
useTilingPatternFill() { return gFalse
; }
63 // Does this device use functionShadedFill(), axialShadedFill(), and
64 // radialShadedFill()? If this returns false, these shaded fills
65 // will be reduced to a series of other drawing operations.
66 virtual GBool
useShadedFills() { return gFalse
; }
68 // Does this device use drawForm()? If this returns false,
69 // form-type XObjects will be interpreted (i.e., unrolled).
70 virtual GBool
useDrawForm() { return gFalse
; }
72 // Does this device use beginType3Char/endType3Char? Otherwise,
73 // text in Type 3 fonts will be drawn with drawChar/drawString.
74 virtual GBool
interpretType3Chars() = 0;
76 // Does this device need non-text content?
77 virtual GBool
needNonText() { return gTrue
; }
79 //----- initialization and control
81 // Set default transform matrix.
82 virtual void setDefaultCTM(double *ctm
);
84 // Check to see if a page slice should be displayed. If this
85 // returns false, the page display is aborted. Typically, an
86 // OutputDev will use some alternate means to display the page
87 // before returning false.
88 virtual GBool
checkPageSlice(Page
*page
, double hDPI
, double vDPI
,
89 int rotate
, GBool useMediaBox
, GBool crop
,
90 int sliceX
, int sliceY
, int sliceW
, int sliceH
,
91 GBool printing
, Catalog
*catalog
,
92 GBool (*abortCheckCbk
)(void *data
) = NULL
,
93 void *abortCheckCbkData
= NULL
)
97 virtual void startPage(int pageNum
, GfxState
*state
) {}
100 virtual void endPage() {}
102 // Dump page contents to display.
103 virtual void dump() {}
105 //----- coordinate conversion
107 // Convert between device and user coordinates.
108 virtual void cvtDevToUser(double dx
, double dy
, double *ux
, double *uy
);
109 virtual void cvtUserToDev(double ux
, double uy
, int *dx
, int *dy
);
111 double *getDefCTM() { return defCTM
; }
112 double *getDefICTM() { return defICTM
; }
114 //----- save/restore graphics state
115 virtual void saveState(GfxState
*state
) {}
116 virtual void restoreState(GfxState
*state
) {}
118 //----- update graphics state
119 virtual void updateAll(GfxState
*state
);
120 virtual void updateCTM(GfxState
*state
, double m11
, double m12
,
121 double m21
, double m22
, double m31
, double m32
) {}
122 virtual void updateLineDash(GfxState
*state
) {}
123 virtual void updateFlatness(GfxState
*state
) {}
124 virtual void updateLineJoin(GfxState
*state
) {}
125 virtual void updateLineCap(GfxState
*state
) {}
126 virtual void updateMiterLimit(GfxState
*state
) {}
127 virtual void updateLineWidth(GfxState
*state
) {}
128 virtual void updateStrokeAdjust(GfxState
*state
) {}
129 virtual void updateFillColorSpace(GfxState
*state
) {}
130 virtual void updateStrokeColorSpace(GfxState
*state
) {}
131 virtual void updateFillColor(GfxState
*state
) {}
132 virtual void updateStrokeColor(GfxState
*state
) {}
133 virtual void updateBlendMode(GfxState
*state
) {}
134 virtual void updateFillOpacity(GfxState
*state
) {}
135 virtual void updateStrokeOpacity(GfxState
*state
) {}
136 virtual void updateFillOverprint(GfxState
*state
) {}
137 virtual void updateStrokeOverprint(GfxState
*state
) {}
138 virtual void updateTransfer(GfxState
*state
) {}
140 //----- update text state
141 virtual void updateFont(GfxState
*state
) {}
142 virtual void updateTextMat(GfxState
*state
) {}
143 virtual void updateCharSpace(GfxState
*state
) {}
144 virtual void updateRender(GfxState
*state
) {}
145 virtual void updateRise(GfxState
*state
) {}
146 virtual void updateWordSpace(GfxState
*state
) {}
147 virtual void updateHorizScaling(GfxState
*state
) {}
148 virtual void updateTextPos(GfxState
*state
) {}
149 virtual void updateTextShift(GfxState
*state
, double shift
) {}
151 //----- path painting
152 virtual void stroke(GfxState
*state
) {}
153 virtual void fill(GfxState
*state
) {}
154 virtual void eoFill(GfxState
*state
) {}
155 virtual void tilingPatternFill(GfxState
*state
, xObject
*str
,
156 int paintType
, Dict
*resDict
,
157 double *mat
, double *bbox
,
158 int x0
, int y0
, int x1
, int y1
,
159 double xStep
, double yStep
) {}
160 virtual GBool
functionShadedFill(GfxState
*state
,
161 GfxFunctionShading
*shading
)
163 virtual GBool
axialShadedFill(GfxState
*state
, GfxAxialShading
*shading
)
165 virtual GBool
radialShadedFill(GfxState
*state
, GfxRadialShading
*shading
)
168 //----- path clipping
169 virtual void clip(GfxState
*state
) {}
170 virtual void eoClip(GfxState
*state
) {}
171 virtual void clipToStrokePath(GfxState
*state
) {}
174 virtual void beginStringOp(GfxState
*state
) {}
175 virtual void endStringOp(GfxState
*state
) {}
176 virtual void beginString(GfxState
*state
, GString
*s
) {}
177 virtual void endString(GfxState
*state
) {}
178 virtual void drawChar(GfxState
*state
, double x
, double y
,
179 double dx
, double dy
,
180 double originX
, double originY
,
181 CharCode code
, int nBytes
, Unicode
*u
, int uLen
) {}
182 virtual void drawString(GfxState
*state
, GString
*s
) {}
183 virtual GBool
beginType3Char(GfxState
*state
, double x
, double y
,
184 double dx
, double dy
,
185 CharCode code
, Unicode
*u
, int uLen
);
186 virtual void endType3Char(GfxState
*state
) {}
187 virtual void endTextObject(GfxState
*state
) {}
189 //----- image drawing
190 virtual void drawImageMask(GfxState
*state
, xObject
*ref
, Stream
*str
,
191 int width
, int height
, GBool invert
,
193 virtual void drawImage(GfxState
*state
, xObject
*ref
, Stream
*str
,
194 int width
, int height
, GfxImageColorMap
*colorMap
,
195 int *maskColors
, GBool inlineImg
);
196 virtual void drawMaskedImage(GfxState
*state
, xObject
*ref
, Stream
*str
,
197 int width
, int height
,
198 GfxImageColorMap
*colorMap
,
199 Stream
*maskStr
, int maskWidth
, int maskHeight
,
201 virtual void drawSoftMaskedImage(GfxState
*state
, xObject
*ref
, Stream
*str
,
202 int width
, int height
,
203 GfxImageColorMap
*colorMap
,
205 int maskWidth
, int maskHeight
,
206 GfxImageColorMap
*maskColorMap
);
209 //----- OPI functions
210 virtual void opiBegin(GfxState
*state
, Dict
*opiDict
);
211 virtual void opiEnd(GfxState
*state
, Dict
*opiDict
);
214 //----- Type 3 font operators
215 virtual void type3D0(GfxState
*state
, double wx
, double wy
) {}
216 virtual void type3D1(GfxState
*state
, double wx
, double wy
,
217 double llx
, double lly
, double urx
, double ury
) {}
219 //----- form XObjects
220 virtual void drawForm(Ref id
) {}
222 //----- PostScript XObjects
223 virtual void psXObject(Stream
*psStream
, Stream
*level1Stream
) {}
225 //----- transparency groups and soft masks
226 virtual void beginTransparencyGroup(GfxState
*state
, double *bbox
,
227 GfxColorSpace
*blendingColorSpace
,
228 GBool isolated
, GBool knockout
,
229 GBool forSoftMask
) {}
230 virtual void endTransparencyGroup(GfxState
*state
) {}
231 virtual void paintTransparencyGroup(GfxState
*state
, double *bbox
) {}
232 virtual void setSoftMask(GfxState
*state
, double *bbox
, GBool alpha
,
233 Function
*transferFunc
, GfxColor
*backdropColor
) {}
234 virtual void clearSoftMask(GfxState
*state
) {}
237 virtual void processLink(Link
*link
, Catalog
*catalog
) {}
239 #if 1 //~tmp: turn off anti-aliasing temporarily
240 virtual GBool
getVectorAntialias() { return gFalse
; }
241 virtual void setVectorAntialias(GBool vaa
) {}
246 double defCTM
[6]; // default coordinate transform matrix
247 double defICTM
[6]; // inverse of default CTM