home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 110 / EnigmaAmiga110CD.iso / indispensabili / utility / apdf / xpdf-0.80 / xpdf / psoutputdev.h < prev    next >
C/C++ Source or Header  |  1999-04-27  |  5KB  |  160 lines

  1. //========================================================================
  2. //
  3. // PSOutputDev.h
  4. //
  5. // Copyright 1996 Derek B. Noonburg
  6. //
  7. //========================================================================
  8.  
  9. #ifndef PSOUTPUTDEV_H
  10. #define PSOUTPUTDEV_H
  11.  
  12. #ifdef __GNUC__
  13. #pragma interface
  14. #endif
  15.  
  16. #include <stddef.h>
  17. #include "config.h"
  18. #include "Object.h"
  19. #include "OutputDev.h"
  20.  
  21. class GfxPath;
  22. class GfxFont;
  23.  
  24. //------------------------------------------------------------------------
  25. // Parameters
  26. //------------------------------------------------------------------------
  27.  
  28. // Generate Level 1 PostScript?
  29. extern GBool psOutLevel1;
  30.  
  31. // Paper size.
  32. extern int paperWidth;
  33. extern int paperHeight;
  34.  
  35. //------------------------------------------------------------------------
  36. // PSOutputDev
  37. //------------------------------------------------------------------------
  38.  
  39. enum PSFileType {
  40.   psFile,                       // write to file
  41.   psPipe,                       // write to pipe
  42.   psStdout                      // write to stdout
  43. };
  44.  
  45. class PSOutputDev: public OutputDev {
  46. public:
  47.  
  48.   // Open a PostScript output file, and write the prolog.
  49.   PSOutputDev(char *fileName, Catalog *catalog,
  50.           int firstPage, int lastPage,
  51.           GBool embedType11, GBool doForm1);
  52.  
  53.   // Destructor -- writes the trailer and closes the file.
  54.   virtual ~PSOutputDev();
  55.  
  56.   // Check if file was successfully created.
  57.   virtual GBool isOk() { return ok; }
  58.  
  59.   //---- get info about output device
  60.  
  61.   // Does this device use upside-down coordinates?
  62.   // (Upside-down means (0,0) is the top left corner of the page.)
  63.   virtual GBool upsideDown() { return gFalse; }
  64.  
  65.   // Does this device use drawChar() or drawString()?
  66.   virtual GBool useDrawChar() { return gFalse; }
  67.  
  68.   //----- initialization and control
  69.  
  70.   // Start a page.
  71.   virtual void startPage(int pageNum, GfxState *state);
  72.  
  73.   // End a page.
  74.   virtual void endPage();
  75.  
  76.   //----- save/restore graphics state
  77.   virtual void saveState(GfxState *state);
  78.   virtual void restoreState(GfxState *state);
  79.  
  80.   //----- update graphics state
  81.   virtual void updateCTM(GfxState *state, double m11, double m12,
  82.              double m21, double m22, double m31, double m32);
  83.   virtual void updateLineDash(GfxState *state);
  84.   virtual void updateFlatness(GfxState *state);
  85.   virtual void updateLineJoin(GfxState *state);
  86.   virtual void updateLineCap(GfxState *state);
  87.   virtual void updateMiterLimit(GfxState *state);
  88.   virtual void updateLineWidth(GfxState *state);
  89.   virtual void updateFillColor(GfxState *state);
  90.   virtual void updateStrokeColor(GfxState *state);
  91.  
  92.   //----- update text state
  93.   virtual void updateFont(GfxState *state);
  94.   virtual void updateTextMat(GfxState *state);
  95.   virtual void updateCharSpace(GfxState *state);
  96.   virtual void updateRender(GfxState *state);
  97.   virtual void updateRise(GfxState *state);
  98.   virtual void updateWordSpace(GfxState *state);
  99.   virtual void updateHorizScaling(GfxState *state);
  100.   virtual void updateTextPos(GfxState *state);
  101.   virtual void updateTextShift(GfxState *state, double shift);
  102.  
  103.   //----- path painting
  104.   virtual void stroke(GfxState *state);
  105.   virtual void fill(GfxState *state);
  106.   virtual void eoFill(GfxState *state);
  107.  
  108.   //----- path clipping
  109.   virtual void clip(GfxState *state);
  110.   virtual void eoClip(GfxState *state);
  111.  
  112.   //----- text drawing
  113.   virtual void drawString(GfxState *state, GString *s);
  114.  
  115.   //----- image drawing
  116.   virtual void drawImageMask(GfxState *state, Stream *str,
  117.                  int width, int height, GBool invert,
  118.                  GBool inlineImg);
  119.   virtual void drawImage(GfxState *state, Stream *str, int width,
  120.              int height, GfxImageColorMap *colorMap,
  121.              GBool inlineImg);
  122.  
  123. private:
  124.  
  125.   void setupFonts(Dict *resDict);
  126.   void setupFont(GfxFont *font);
  127.   void setupEmbeddedFont(Ref *id);
  128.   void setupEmbeddedFont(char *fileName);
  129.   void doPath(GfxPath *path);
  130.   void doImageL1(GfxImageColorMap *colorMap,
  131.          GBool invert, GBool inlineImg,
  132.          Stream *str, int width, int height, int len);
  133.   void doImage(GfxImageColorMap *colorMap,
  134.            GBool invert, GBool inlineImg,
  135.            Stream *str, int width, int height, int len);
  136.   void writePS(char *fmt, ...);
  137.   void writePSString(GString *s);
  138.  
  139.   GBool embedType1;             // embed Type 1 fonts?
  140.   GBool doForm;                 // generate a form?
  141.  
  142.   FILE *f;                      // PostScript file
  143.   PSFileType fileType;          // file / pipe / stdout
  144.   int seqPage;                  // current sequential page number
  145.  
  146.   Ref *fontIDs;                 // list of object IDs of all used fonts
  147.   int fontIDLen;                // number of entries in fontIDs array
  148.   int fontIDSize;               // size of fontIDs array
  149.   Ref *fontFileIDs;             // list of object IDs of all embedded fonts
  150.   int fontFileIDLen;            // number of entries in fontFileIDs array
  151.   int fontFileIDSize;           // size of fontFileIDs array
  152.   char **fontFileNames;         // list of names of all embedded external fonts
  153.   int fontFileNameLen;          // number of entries in fontFileNames array
  154.   int fontFileNameSize;         // size of fontFileNames array
  155.  
  156.   GBool ok;                     // set up ok?
  157. };
  158.  
  159. #endif
  160.