/src/xpdf-4.06/xpdf/OutputDev.h
Line | Count | Source |
1 | | //======================================================================== |
2 | | // |
3 | | // OutputDev.h |
4 | | // |
5 | | // Copyright 1996-2003 Glyph & Cog, LLC |
6 | | // |
7 | | //======================================================================== |
8 | | |
9 | | #ifndef OUTPUTDEV_H |
10 | | #define OUTPUTDEV_H |
11 | | |
12 | | #include <aconf.h> |
13 | | |
14 | | #include "gtypes.h" |
15 | | #include "CharTypes.h" |
16 | | |
17 | | class GString; |
18 | | class Gfx; |
19 | | class GfxState; |
20 | | struct GfxColor; |
21 | | class GfxColorSpace; |
22 | | class GfxImageColorMap; |
23 | | class GfxShading; |
24 | | class Stream; |
25 | | class Links; |
26 | | class Link; |
27 | | class Catalog; |
28 | | class Page; |
29 | | class Function; |
30 | | |
31 | | //------------------------------------------------------------------------ |
32 | | // OutputDev |
33 | | //------------------------------------------------------------------------ |
34 | | |
35 | | class OutputDev { |
36 | | public: |
37 | | |
38 | | // Constructor. |
39 | 14.9k | OutputDev() {} |
40 | | |
41 | | // Destructor. |
42 | 14.9k | virtual ~OutputDev() {} |
43 | | |
44 | | //----- get info about output device |
45 | | |
46 | | // Does this device use upside-down coordinates? |
47 | | // (Upside-down means (0,0) is the top left corner of the page.) |
48 | | virtual GBool upsideDown() = 0; |
49 | | |
50 | | // Does this device use drawChar() or drawString()? |
51 | | virtual GBool useDrawChar() = 0; |
52 | | |
53 | | // Does this device use tilingPatternFill()? If this returns false, |
54 | | // tiling pattern fills will be reduced to a series of other drawing |
55 | | // operations. |
56 | 0 | virtual GBool useTilingPatternFill() { return gFalse; } |
57 | | |
58 | | // Does this device use drawForm()? If this returns false, |
59 | | // form-type XObjects will be interpreted (i.e., unrolled). |
60 | 59.9k | virtual GBool useDrawForm() { return gFalse; } |
61 | | |
62 | | // Does this device use beginType3Char/endType3Char? Otherwise, |
63 | | // text in Type 3 fonts will be drawn with drawChar/drawString. |
64 | | virtual GBool interpretType3Chars() = 0; |
65 | | |
66 | | // Does this device need non-text content? |
67 | 169k | virtual GBool needNonText() { return gTrue; } |
68 | | |
69 | | // Does this device require incCharCount to be called for text on |
70 | | // non-shown layers? |
71 | 916 | virtual GBool needCharCount() { return gFalse; } |
72 | | |
73 | | |
74 | | |
75 | | //----- initialization and control |
76 | | |
77 | | // Set default transform matrix. |
78 | | virtual void setDefaultCTM(double *ctm); |
79 | | |
80 | | // Check to see if a page slice should be displayed. If this |
81 | | // returns false, the page display is aborted. Typically, an |
82 | | // OutputDev will use some alternate means to display the page |
83 | | // before returning false. |
84 | | virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI, |
85 | | int rotate, GBool useMediaBox, GBool crop, |
86 | | int sliceX, int sliceY, int sliceW, int sliceH, |
87 | | GBool printing, |
88 | | GBool (*abortCheckCbk)(void *data) = NULL, |
89 | | void *abortCheckCbkData = NULL) |
90 | 359k | { return gTrue; } |
91 | | |
92 | | // Start a page. |
93 | 0 | virtual void startPage(int pageNum, GfxState *state) {} |
94 | | |
95 | | // End a page. |
96 | 0 | virtual void endPage() {} |
97 | | |
98 | | // Start/end a sub-page stream (Form XObject, annotation). |
99 | 110k | virtual void startStream(Ref streamRef, GfxState *state) {} |
100 | 110k | virtual void endStream(Ref streamRef) {} |
101 | | |
102 | | //----- coordinate conversion |
103 | | |
104 | | // Convert between device and user coordinates. |
105 | | virtual void cvtDevToUser(double dx, double dy, double *ux, double *uy); |
106 | | virtual void cvtUserToDev(double ux, double uy, double *dx, double *dy); |
107 | | virtual void cvtUserToDev(double ux, double uy, int *dx, int *dy); |
108 | | |
109 | 0 | double *getDefCTM() { return defCTM; } |
110 | 0 | double *getDefICTM() { return defICTM; } |
111 | | |
112 | | //----- save/restore graphics state |
113 | 0 | virtual void saveState(GfxState *state) {} |
114 | 0 | virtual void restoreState(GfxState *state) {} |
115 | | |
116 | | //----- update graphics state |
117 | | virtual void updateAll(GfxState *state); |
118 | | virtual void updateCTM(GfxState *state, double m11, double m12, |
119 | 0 | double m21, double m22, double m31, double m32) {} |
120 | 0 | virtual void updateLineDash(GfxState *state) {} |
121 | 0 | virtual void updateFlatness(GfxState *state) {} |
122 | 0 | virtual void updateLineJoin(GfxState *state) {} |
123 | 0 | virtual void updateLineCap(GfxState *state) {} |
124 | 0 | virtual void updateMiterLimit(GfxState *state) {} |
125 | 0 | virtual void updateLineWidth(GfxState *state) {} |
126 | 0 | virtual void updateStrokeAdjust(GfxState *state) {} |
127 | 324k | virtual void updateFillColorSpace(GfxState *state) {} |
128 | 191k | virtual void updateStrokeColorSpace(GfxState *state) {} |
129 | 0 | virtual void updateFillColor(GfxState *state) {} |
130 | 0 | virtual void updateStrokeColor(GfxState *state) {} |
131 | 0 | virtual void updateBlendMode(GfxState *state) {} |
132 | 0 | virtual void updateFillOpacity(GfxState *state) {} |
133 | 0 | virtual void updateStrokeOpacity(GfxState *state) {} |
134 | 3.42k | virtual void updateFillOverprint(GfxState *state) {} |
135 | 2.20k | virtual void updateStrokeOverprint(GfxState *state) {} |
136 | 2.37k | virtual void updateOverprintMode(GfxState *state) {} |
137 | 0 | virtual void updateRenderingIntent(GfxState *state) {} |
138 | 0 | virtual void updateTransfer(GfxState *state) {} |
139 | 0 | virtual void updateAlphaIsShape(GfxState *state) {} |
140 | | |
141 | | //----- update text state |
142 | 0 | virtual void updateFont(GfxState *state) {} |
143 | 390k | virtual void updateTextMat(GfxState *state) {} |
144 | 18.9k | virtual void updateCharSpace(GfxState *state) {} |
145 | 5.88k | virtual void updateRender(GfxState *state) {} |
146 | 1.09k | virtual void updateRise(GfxState *state) {} |
147 | 5.63k | virtual void updateWordSpace(GfxState *state) {} |
148 | 16.0k | virtual void updateHorizScaling(GfxState *state) {} |
149 | 537k | virtual void updateTextPos(GfxState *state) {} |
150 | 394k | virtual void updateTextShift(GfxState *state, double shift) {} |
151 | | |
152 | | //----- path painting |
153 | 0 | virtual void stroke(GfxState *state) {} |
154 | 0 | virtual void fill(GfxState *state) {} |
155 | 0 | virtual void eoFill(GfxState *state) {} |
156 | | virtual void fillStroke(GfxState *state, GBool eo); |
157 | | virtual void tilingPatternFill(GfxState *state, Gfx *gfx, Object *strRef, |
158 | | int paintType, int tilingType, Dict *resDict, |
159 | | double *mat, double *bbox, |
160 | | int x0, int y0, int x1, int y1, |
161 | 0 | double xStep, double yStep) {} |
162 | | virtual GBool shadedFill(GfxState *state, GfxShading *shading) |
163 | 0 | { return gFalse; } |
164 | | |
165 | | //----- path clipping |
166 | 0 | virtual void clip(GfxState *state) {} |
167 | 0 | virtual void eoClip(GfxState *state) {} |
168 | 0 | virtual void clipToStrokePath(GfxState *state) {} |
169 | | |
170 | | //----- text drawing |
171 | 319k | virtual void beginStringOp(GfxState *state) {} |
172 | 319k | virtual void endStringOp(GfxState *state) {} |
173 | 594k | virtual void beginString(GfxState *state, GString *s) {} |
174 | 594k | virtual void endString(GfxState *state) {} |
175 | | virtual void drawChar(GfxState *state, double x, double y, |
176 | | double dx, double dy, |
177 | | double originX, double originY, |
178 | | CharCode code, int nBytes, Unicode *u, int uLen, |
179 | 0 | GBool fill, GBool stroke, GBool makePath) {} |
180 | | virtual void drawString(GfxState *state, GString *s, |
181 | 0 | GBool fill, GBool stroke, GBool makePath) {} |
182 | 0 | virtual void fillTextPath(GfxState *state) {} |
183 | 0 | virtual void strokeTextPath(GfxState *state) {} |
184 | 0 | virtual void clipToTextPath(GfxState *state) {} |
185 | 0 | virtual void clipToTextStrokePath(GfxState *state) {} |
186 | 0 | virtual void clearTextPath(GfxState *state) {} |
187 | 0 | virtual void addTextPathToSavedClipPath(GfxState *state) {} |
188 | 0 | virtual void clipToSavedClipPath(GfxState *state) {} |
189 | | virtual GBool beginType3Char(GfxState *state, double x, double y, |
190 | | double dx, double dy, |
191 | | CharCode code, Unicode *u, int uLen); |
192 | 0 | virtual void endType3Char(GfxState *state) {} |
193 | 0 | virtual void endTextObject(GfxState *state) {} |
194 | 0 | virtual void incCharCount(int nChars) {} |
195 | 50 | virtual void beginActualText(GfxState *state, Unicode *u, int uLen) {} |
196 | 50 | virtual void endActualText(GfxState *state) {} |
197 | | |
198 | | //----- image drawing |
199 | | virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, |
200 | | int width, int height, GBool invert, |
201 | | GBool inlineImg, GBool interpolate); |
202 | | virtual void setSoftMaskFromImageMask(GfxState *state, |
203 | | Object *ref, Stream *str, |
204 | | int width, int height, GBool invert, |
205 | | GBool inlineImg, GBool interpolate); |
206 | | virtual void drawImage(GfxState *state, Object *ref, Stream *str, |
207 | | int width, int height, GfxImageColorMap *colorMap, |
208 | | int *maskColors, GBool inlineImg, GBool interpolate); |
209 | | virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, |
210 | | int width, int height, |
211 | | GfxImageColorMap *colorMap, |
212 | | Object *maskRef, Stream *maskStr, |
213 | | int maskWidth, int maskHeight, |
214 | | GBool maskInvert, GBool interpolate); |
215 | | virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, |
216 | | int width, int height, |
217 | | GfxImageColorMap *colorMap, |
218 | | Object *maskRef, Stream *maskStr, |
219 | | int maskWidth, int maskHeight, |
220 | | GfxImageColorMap *maskColorMap, |
221 | | double *matte, GBool interpolate); |
222 | | |
223 | | #if OPI_SUPPORT |
224 | | //----- OPI functions |
225 | | virtual void opiBegin(GfxState *state, Dict *opiDict); |
226 | | virtual void opiEnd(GfxState *state, Dict *opiDict); |
227 | | #endif |
228 | | |
229 | | //----- Type 3 font operators |
230 | 0 | virtual void type3D0(GfxState *state, double wx, double wy) {} |
231 | | virtual void type3D1(GfxState *state, double wx, double wy, |
232 | 0 | double llx, double lly, double urx, double ury) {} |
233 | | |
234 | | //----- form XObjects |
235 | 0 | virtual void drawForm(Ref id) {} |
236 | | |
237 | | //----- PostScript XObjects |
238 | 0 | virtual void psXObject(Stream *psStream, Stream *level1Stream) {} |
239 | | |
240 | | //----- transparency groups and soft masks |
241 | | virtual GBool beginTransparencyGroup(GfxState *state, double *bbox, |
242 | | GfxColorSpace *blendingColorSpace, |
243 | | GBool isolated, GBool knockout, |
244 | 0 | GBool forSoftMask) { return gTrue; } |
245 | 0 | virtual void endTransparencyGroup(GfxState *state) {} |
246 | 0 | virtual void paintTransparencyGroup(GfxState *state, double *bbox) {} |
247 | | virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha, |
248 | 0 | Function *transferFunc, GfxColor *backdropColor) {} |
249 | 0 | virtual void clearSoftMask(GfxState *state) {} |
250 | | |
251 | | //----- links |
252 | 0 | virtual void processLink(Link *link) {} |
253 | | |
254 | | //----- structure tree |
255 | 1.32k | virtual void beginStructureItem(const char *tag, int mcid, Dict *dict) {} |
256 | 1.32k | virtual void endStructureItem() {} |
257 | | |
258 | | private: |
259 | | |
260 | | double defCTM[6]; // default coordinate transform matrix |
261 | | double defICTM[6]; // inverse of default CTM |
262 | | }; |
263 | | |
264 | | #endif |