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