X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=pdf%2Fxpdf%2FPSOutputDev.h;h=fbfc3a5c3d536ab9c0d0caca07f6117ba0fd58d4;hb=64676031423465996e83c4a685290f0c3d97a249;hp=ba208dea439fcc4e4c00938e00ce6bb01dbe9bd9;hpb=28c37dbcf87665a4ccec58bef9ef8ff0697022dd;p=evince.git diff --git a/pdf/xpdf/PSOutputDev.h b/pdf/xpdf/PSOutputDev.h index ba208dea..fbfc3a5c 100644 --- a/pdf/xpdf/PSOutputDev.h +++ b/pdf/xpdf/PSOutputDev.h @@ -9,7 +9,9 @@ #ifndef PSOUTPUTDEV_H #define PSOUTPUTDEV_H -#ifdef __GNUC__ +#include + +#ifdef USE_GCC_PRAGMAS #pragma interface #endif @@ -39,9 +41,12 @@ enum PSOutMode { enum PSFileType { psFile, // write to file psPipe, // write to pipe - psStdout // write to stdout + psStdout, // write to stdout + psGeneric // write to a generic stream }; +typedef void (*PSOutputFunc)(void *stream, char *data, int len); + class PSOutputDev: public OutputDev { public: @@ -49,6 +54,11 @@ public: PSOutputDev(char *fileName, XRef *xrefA, Catalog *catalog, int firstPage, int lastPage, PSOutMode modeA); + // Open a PSOutputDev that will write to a generic stream. + PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA, + XRef *xrefA, Catalog *catalog, + int firstPage, int lastPage, PSOutMode modeA); + // Destructor -- writes the trailer and closes the file. virtual ~PSOutputDev(); @@ -137,8 +147,12 @@ public: //----- PostScript XObjects virtual void psXObject(Stream *psStream, Stream *level1Stream); + private: + void init(PSOutputFunc outputFuncA, void *outputStreamA, + PSFileType fileTypeA, XRef *xrefA, Catalog *catalog, + int firstPage, int lastPage, PSOutMode modeA); void setupResources(Dict *resDict); void setupFonts(Dict *resDict); void setupFont(GfxFont *font, Dict *parentResDict); @@ -172,9 +186,11 @@ private: double *x1, double *y1); GBool getFileSpec(Object *fileSpec, Object *fileName); #endif - void writePS(const char *fmt, ...); - void writePSString(GString *s); void writePSChar(char c); + void writePS(char *s); + void writePSFmt(const char *fmt, ...); + void writePSString(GString *s); + void writePSName(char *s); GString *filterPSName(GString *name); PSLevel level; // PostScript level (1, 2, separation) @@ -182,7 +198,8 @@ private: int paperWidth; // width of paper, in pts int paperHeight; // height of paper, in pts - FILE *f; // PostScript file + PSOutputFunc outputFunc; + void *outputStream; PSFileType fileType; // file / pipe / stdout int seqPage; // current sequential page number @@ -223,6 +240,7 @@ private: #endif GBool ok; // set up ok? + }; #endif