1 //========================================================================
5 // Copyright 1996-2002 Glyph & Cog, LLC
7 //========================================================================
17 #include "CharTypes.h"
22 class GfxImageColorMap;
27 //------------------------------------------------------------------------
29 //------------------------------------------------------------------------
38 virtual ~OutputDev() {}
40 //----- get info about output device
42 // Does this device use upside-down coordinates?
43 // (Upside-down means (0,0) is the top left corner of the page.)
44 virtual GBool upsideDown() = 0;
46 // Does this device use drawChar() or drawString()?
47 virtual GBool useDrawChar() = 0;
49 // Does this device use beginType3Char/endType3Char? Otherwise,
50 // text in Type 3 fonts will be drawn with drawChar/drawString.
51 virtual GBool interpretType3Chars() = 0;
53 // Does this device need non-text content?
54 virtual GBool needNonText() { return gTrue; }
56 //----- initialization and control
58 // Set default transform matrix.
59 virtual void setDefaultCTM(double *ctm);
62 virtual void startPage(int pageNum, GfxState *state) {}
65 virtual void endPage() {}
67 // Dump page contents to display.
68 virtual void dump() {}
70 //----- coordinate conversion
72 // Convert between device and user coordinates.
73 virtual void cvtDevToUser(int dx, int dy, double *ux, double *uy);
74 virtual void cvtUserToDev(double ux, double uy, int *dx, int *dy);
77 virtual void drawLink(Link *link, Catalog *catalog) {}
79 //----- save/restore graphics state
80 virtual void saveState(GfxState *state) {}
81 virtual void restoreState(GfxState *state) {}
83 //----- update graphics state
84 virtual void updateAll(GfxState *state);
85 virtual void updateCTM(GfxState *state, double m11, double m12,
86 double m21, double m22, double m31, double m32) {}
87 virtual void updateLineDash(GfxState *state) {}
88 virtual void updateFlatness(GfxState *state) {}
89 virtual void updateLineJoin(GfxState *state) {}
90 virtual void updateLineCap(GfxState *state) {}
91 virtual void updateMiterLimit(GfxState *state) {}
92 virtual void updateLineWidth(GfxState *state) {}
93 virtual void updateFillColor(GfxState *state) {}
94 virtual void updateStrokeColor(GfxState *state) {}
95 virtual void updateFillOpacity(GfxState *state) {}
96 virtual void updateStrokeOpacity(GfxState *state) {}
98 //----- update text state
99 virtual void updateFont(GfxState *state) {}
100 virtual void updateTextMat(GfxState *state) {}
101 virtual void updateCharSpace(GfxState *state) {}
102 virtual void updateRender(GfxState *state) {}
103 virtual void updateRise(GfxState *state) {}
104 virtual void updateWordSpace(GfxState *state) {}
105 virtual void updateHorizScaling(GfxState *state) {}
106 virtual void updateTextPos(GfxState *state) {}
107 virtual void updateTextShift(GfxState *state, double shift) {}
109 //----- path painting
110 virtual void stroke(GfxState *state) {}
111 virtual void fill(GfxState *state) {}
112 virtual void eoFill(GfxState *state) {}
114 //----- path clipping
115 virtual void clip(GfxState *state) {}
116 virtual void eoClip(GfxState *state) {}
119 virtual void beginString(GfxState *state, GString *s) {}
120 virtual void endString(GfxState *state) {}
121 virtual void drawChar(GfxState *state, double x, double y,
122 double dx, double dy,
123 double originX, double originY,
124 CharCode code, Unicode *u, int uLen) {}
125 virtual void drawString(GfxState *state, GString *s) {}
126 virtual GBool beginType3Char(GfxState *state,
127 CharCode code, Unicode *u, int uLen);
128 virtual void endType3Char(GfxState *state) {}
130 //----- image drawing
131 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
132 int width, int height, GBool invert,
134 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
135 int width, int height, GfxImageColorMap *colorMap,
136 int *maskColors, GBool inlineImg);
139 //----- OPI functions
140 virtual void opiBegin(GfxState *state, Dict *opiDict);
141 virtual void opiEnd(GfxState *state, Dict *opiDict);
144 //----- Type 3 font operators
145 virtual void type3D0(GfxState *state, double wx, double wy) {}
146 virtual void type3D1(GfxState *state, double wx, double wy,
147 double llx, double lly, double urx, double ury) {}
149 //----- PostScript XObjects
150 virtual void psXObject(Stream *psStream, Stream *level1Stream) {}
154 double defCTM[6]; // default coordinate transform matrix
155 double defICTM[6]; // inverse of default CTM