Back to index

tetex-bin  3.0
OutputDev.h
Go to the documentation of this file.
00001 //========================================================================
00002 //
00003 // OutputDev.h
00004 //
00005 // Copyright 1996-2003 Glyph & Cog, LLC
00006 //
00007 //========================================================================
00008 
00009 #ifndef OUTPUTDEV_H
00010 #define OUTPUTDEV_H
00011 
00012 #include <aconf.h>
00013 
00014 #ifdef USE_GCC_PRAGMAS
00015 #pragma interface
00016 #endif
00017 
00018 #include "gtypes.h"
00019 #include "CharTypes.h"
00020 
00021 class GString;
00022 class GfxState;
00023 class GfxColorSpace;
00024 class GfxImageColorMap;
00025 class Stream;
00026 class Link;
00027 class Catalog;
00028 
00029 //------------------------------------------------------------------------
00030 // OutputDev
00031 //------------------------------------------------------------------------
00032 
00033 class OutputDev {
00034 public:
00035 
00036   // Constructor.
00037   OutputDev() {}
00038 
00039   // Destructor.
00040   virtual ~OutputDev() {}
00041 
00042   //----- get info about output device
00043 
00044   // Does this device use upside-down coordinates?
00045   // (Upside-down means (0,0) is the top left corner of the page.)
00046   virtual GBool upsideDown() = 0;
00047 
00048   // Does this device use drawChar() or drawString()?
00049   virtual GBool useDrawChar() = 0;
00050 
00051   // Does this device use beginType3Char/endType3Char?  Otherwise,
00052   // text in Type 3 fonts will be drawn with drawChar/drawString.
00053   virtual GBool interpretType3Chars() = 0;
00054 
00055   // Does this device need non-text content?
00056   virtual GBool needNonText() { return gTrue; }
00057 
00058   //----- initialization and control
00059 
00060   // Set default transform matrix.
00061   virtual void setDefaultCTM(double *ctm);
00062 
00063   // Start a page.
00064   virtual void startPage(int pageNum, GfxState *state) {}
00065 
00066   // End a page.
00067   virtual void endPage() {}
00068 
00069   // Dump page contents to display.
00070   virtual void dump() {}
00071 
00072   //----- coordinate conversion
00073 
00074   // Convert between device and user coordinates.
00075   virtual void cvtDevToUser(double dx, double dy, double *ux, double *uy);
00076   virtual void cvtUserToDev(double ux, double uy, int *dx, int *dy);
00077 
00078   //----- link borders
00079   virtual void drawLink(Link *link, Catalog *catalog) {}
00080 
00081   //----- save/restore graphics state
00082   virtual void saveState(GfxState *state) {}
00083   virtual void restoreState(GfxState *state) {}
00084 
00085   //----- update graphics state
00086   virtual void updateAll(GfxState *state);
00087   virtual void updateCTM(GfxState *state, double m11, double m12,
00088                       double m21, double m22, double m31, double m32) {}
00089   virtual void updateLineDash(GfxState *state) {}
00090   virtual void updateFlatness(GfxState *state) {}
00091   virtual void updateLineJoin(GfxState *state) {}
00092   virtual void updateLineCap(GfxState *state) {}
00093   virtual void updateMiterLimit(GfxState *state) {}
00094   virtual void updateLineWidth(GfxState *state) {}
00095   virtual void updateFillColor(GfxState *state) {}
00096   virtual void updateStrokeColor(GfxState *state) {}
00097   virtual void updateFillOpacity(GfxState *state) {}
00098   virtual void updateStrokeOpacity(GfxState *state) {}
00099 
00100   //----- update text state
00101   virtual void updateFont(GfxState *state) {}
00102   virtual void updateTextMat(GfxState *state) {}
00103   virtual void updateCharSpace(GfxState *state) {}
00104   virtual void updateRender(GfxState *state) {}
00105   virtual void updateRise(GfxState *state) {}
00106   virtual void updateWordSpace(GfxState *state) {}
00107   virtual void updateHorizScaling(GfxState *state) {}
00108   virtual void updateTextPos(GfxState *state) {}
00109   virtual void updateTextShift(GfxState *state, double shift) {}
00110 
00111   //----- path painting
00112   virtual void stroke(GfxState *state) {}
00113   virtual void fill(GfxState *state) {}
00114   virtual void eoFill(GfxState *state) {}
00115 
00116   //----- path clipping
00117   virtual void clip(GfxState *state) {}
00118   virtual void eoClip(GfxState *state) {}
00119 
00120   //----- text drawing
00121   virtual void beginString(GfxState *state, GString *s) {}
00122   virtual void endString(GfxState *state) {}
00123   virtual void drawChar(GfxState *state, double x, double y,
00124                      double dx, double dy,
00125                      double originX, double originY,
00126                      CharCode code, Unicode *u, int uLen) {}
00127   virtual void drawString(GfxState *state, GString *s) {}
00128   virtual GBool beginType3Char(GfxState *state, double x, double y,
00129                             double dx, double dy,
00130                             CharCode code, Unicode *u, int uLen);
00131   virtual void endType3Char(GfxState *state) {}
00132   virtual void endTextObject(GfxState *state) {}
00133 
00134   //----- image drawing
00135   virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
00136                           int width, int height, GBool invert,
00137                           GBool inlineImg);
00138   virtual void drawImage(GfxState *state, Object *ref, Stream *str,
00139                       int width, int height, GfxImageColorMap *colorMap,
00140                       int *maskColors, GBool inlineImg);
00141 
00142 #if OPI_SUPPORT
00143   //----- OPI functions
00144   virtual void opiBegin(GfxState *state, Dict *opiDict);
00145   virtual void opiEnd(GfxState *state, Dict *opiDict);
00146 #endif
00147 
00148   //----- Type 3 font operators
00149   virtual void type3D0(GfxState *state, double wx, double wy) {}
00150   virtual void type3D1(GfxState *state, double wx, double wy,
00151                      double llx, double lly, double urx, double ury) {}
00152 
00153   //----- PostScript XObjects
00154   virtual void psXObject(Stream *psStream, Stream *level1Stream) {}
00155 
00156 private:
00157 
00158   double defCTM[6];         // default coordinate transform matrix
00159   double defICTM[6];        // inverse of default CTM
00160 };
00161 
00162 #endif