applied diff between xpdf-3.00-orig and xpdf-3.00-swftools
[swftools.git] / pdf2swf / xpdf / OutputDev.h
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 #ifdef USE_GCC_PRAGMAS
15 #pragma interface
16 #endif
17
18 #include "gtypes.h"
19 #include "CharTypes.h"
20
21 class GString;
22 class GfxState;
23 class GfxColorSpace;
24 class GfxImageColorMap;
25 class GfxFunctionShading;
26 class GfxAxialShading;
27 class GfxRadialShading;
28 class Stream;
29 class Link;
30 class Catalog;
31
32 //------------------------------------------------------------------------
33 // OutputDev
34 //------------------------------------------------------------------------
35
36 class OutputDev {
37 public:
38
39   // Constructor.
40   OutputDev() {}
41
42   // Destructor.
43   virtual ~OutputDev() {}
44
45   //----- get info about output device
46
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;
50
51   // Does this device use drawChar() or drawString()?
52   virtual GBool useDrawChar() = 0;
53
54   // Does this device use tilingPatternFill()?  If this returns false,
55   // tiling pattern fills will be reduced to a series of other drawing
56   // operations.
57   virtual GBool useTilingPatternFill() { return gFalse; }
58
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; }
63
64   // Is this device able to draw gradients?
65   virtual GBool useGradients() = 0;
66
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;
70
71   // Does this device need non-text content?
72   virtual GBool needNonText() { return gTrue; }
73
74   //----- initialization and control
75
76   // Set default transform matrix.
77   virtual void setDefaultCTM(double *ctm);
78
79   // Start a page.
80   virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {}
81
82   // End a page.
83   virtual void endPage() {}
84
85   // Dump page contents to display.
86   virtual void dump() {}
87
88   //----- coordinate conversion
89
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);
93
94   double *getDefCTM() { return defCTM; }
95   double *getDefICTM() { return defICTM; }
96
97   //----- link borders
98   virtual void drawLink(Link *link, Catalog *catalog) {}
99
100   //----- save/restore graphics state
101   virtual void saveState(GfxState *state) {}
102   virtual void restoreState(GfxState *state) {}
103
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) {}
123
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) {}
134
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) {}
148
149   //----- path clipping
150   virtual void clip(GfxState *state) {}
151   virtual void eoClip(GfxState *state) {}
152
153   //----- text drawing
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) {}
168
169   //----- image drawing
170   virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
171                              int width, int height, GBool invert,
172                              GBool inlineImg);
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,
180                                GBool maskInvert);
181   virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
182                                    int width, int height,
183                                    GfxImageColorMap *colorMap,
184                                    Stream *maskStr,
185                                    int maskWidth, int maskHeight,
186                                    GfxImageColorMap *maskColorMap);
187
188 #if OPI_SUPPORT
189   //----- OPI functions
190   virtual void opiBegin(GfxState *state, Dict *opiDict);
191   virtual void opiEnd(GfxState *state, Dict *opiDict);
192 #endif
193
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) {}
198
199   //----- PostScript XObjects
200   virtual void psXObject(Stream *psStream, Stream *level1Stream) {}
201
202 private:
203
204   double defCTM[6];             // default coordinate transform matrix
205   double defICTM[6];            // inverse of default CTM
206 };
207
208 #endif