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 // Is this device able to draw gradients?
52 virtual GBool useGradients() = 0;
54 // Does this device use beginType3Char/endType3Char? Otherwise,
55 // text in Type 3 fonts will be drawn with drawChar/drawString.
56 virtual GBool interpretType3Chars() = 0;
58 // Does this device need non-text content?
59 virtual GBool needNonText() { return gTrue; }
61 //----- initialization and control
63 // Set default transform matrix.
64 virtual void setDefaultCTM(double *ctm);
67 virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {}
70 virtual void endPage() {}
72 // Dump page contents to display.
73 virtual void dump() {}
75 //----- coordinate conversion
77 // Convert between device and user coordinates.
78 virtual void cvtDevToUser(double dx, double dy, double *ux, double *uy);
79 virtual void cvtUserToDev(double ux, double uy, int *dx, int *dy);
82 virtual void drawLink(Link *link, Catalog *catalog) {}
84 //----- save/restore graphics state
85 virtual void saveState(GfxState *state) {}
86 virtual void restoreState(GfxState *state) {}
88 //----- update graphics state
89 virtual void updateAll(GfxState *state);
90 virtual void updateCTM(GfxState *state, double m11, double m12,
91 double m21, double m22, double m31, double m32) {}
92 virtual void updateLineDash(GfxState *state) {}
93 virtual void updateFlatness(GfxState *state) {}
94 virtual void updateLineJoin(GfxState *state) {}
95 virtual void updateLineCap(GfxState *state) {}
96 virtual void updateMiterLimit(GfxState *state) {}
97 virtual void updateLineWidth(GfxState *state) {}
98 virtual void updateFillColor(GfxState *state) {}
99 virtual void updateStrokeColor(GfxState *state) {}
100 virtual void updateFillOpacity(GfxState *state) {}
101 virtual void updateStrokeOpacity(GfxState *state) {}
103 //----- update text state
104 virtual void updateFont(GfxState *state) {}
105 virtual void updateTextMat(GfxState *state) {}
106 virtual void updateCharSpace(GfxState *state) {}
107 virtual void updateRender(GfxState *state) {}
108 virtual void updateRise(GfxState *state) {}
109 virtual void updateWordSpace(GfxState *state) {}
110 virtual void updateHorizScaling(GfxState *state) {}
111 virtual void updateTextPos(GfxState *state) {}
112 virtual void updateTextShift(GfxState *state, double shift) {}
114 //----- path painting
115 virtual void stroke(GfxState *state) {}
116 virtual void fill(GfxState *state) {}
117 virtual void eoFill(GfxState *state) {}
119 //----- path clipping
120 virtual void clip(GfxState *state) {}
121 virtual void eoClip(GfxState *state) {}
124 virtual void beginString(GfxState *state, GString *s) {}
125 virtual void endString(GfxState *state) {}
126 virtual void drawChar(GfxState *state, double x, double y,
127 double dx, double dy,
128 double originX, double originY,
129 CharCode code, Unicode *u, int uLen) {}
130 virtual void drawString(GfxState *state, GString *s) {}
131 virtual GBool beginType3Char(GfxState *state, double x, double y,
132 double dx, double dy,
133 CharCode code, Unicode *u, int uLen);
134 virtual void endType3Char(GfxState *state) {}
135 virtual void endTextObject(GfxState *state) {}
137 //----- image drawing
138 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
139 int width, int height, GBool invert,
141 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
142 int width, int height, GfxImageColorMap *colorMap,
143 int *maskColors, GBool inlineImg);
146 //----- OPI functions
147 virtual void opiBegin(GfxState *state, Dict *opiDict);
148 virtual void opiEnd(GfxState *state, Dict *opiDict);
151 //----- Type 3 font operators
152 virtual void type3D0(GfxState *state, double wx, double wy) {}
153 virtual void type3D1(GfxState *state, double wx, double wy,
154 double llx, double lly, double urx, double ury) {}
156 //----- PostScript XObjects
157 virtual void psXObject(Stream *psStream, Stream *level1Stream) {}
161 double defCTM[6]; // default coordinate transform matrix
162 double defICTM[6]; // inverse of default CTM