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