00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef PSOUTPUTDEV_H
00010 #define PSOUTPUTDEV_H
00011
00012 #include <aconf.h>
00013
00014 #ifdef USE_GCC_PRAGMAS
00015 #pragma interface
00016 #endif
00017
00018 #include <stddef.h>
00019 #include "config.h"
00020 #include "Object.h"
00021 #include "GlobalParams.h"
00022 #include "OutputDev.h"
00023
00024 class GfxPath;
00025 class GfxFont;
00026 class GfxColorSpace;
00027 class GfxSeparationColorSpace;
00028 struct PSFont16Enc;
00029 class PSOutCustomColor;
00030
00031
00032
00033
00034
00035 enum PSOutMode {
00036 psModePS,
00037 psModeEPS,
00038 psModeForm
00039 };
00040
00041 enum PSFileType {
00042 psFile,
00043 psPipe,
00044 psStdout,
00045 psGeneric
00046 };
00047
00048 typedef void (*PSOutputFunc)(void *stream, char *data, int len);
00049
00050 class PSOutputDev: public OutputDev {
00051 public:
00052
00053
00054 PSOutputDev(char *fileName, XRef *xrefA, Catalog *catalog,
00055 int firstPage, int lastPage, PSOutMode modeA);
00056
00057
00058 PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA,
00059 XRef *xrefA, Catalog *catalog,
00060 int firstPage, int lastPage, PSOutMode modeA);
00061
00062
00063 virtual ~PSOutputDev();
00064
00065
00066 virtual GBool isOk() { return ok; }
00067
00068
00069
00070
00071
00072 virtual GBool upsideDown() { return gFalse; }
00073
00074
00075 virtual GBool useDrawChar() { return gFalse; }
00076
00077
00078
00079 virtual GBool interpretType3Chars() { return gFalse; }
00080
00081
00082
00083
00084 virtual void startPage(int pageNum, GfxState *state);
00085
00086
00087 virtual void endPage();
00088
00089
00090 virtual void saveState(GfxState *state);
00091 virtual void restoreState(GfxState *state);
00092
00093
00094 virtual void updateCTM(GfxState *state, double m11, double m12,
00095 double m21, double m22, double m31, double m32);
00096 virtual void updateLineDash(GfxState *state);
00097 virtual void updateFlatness(GfxState *state);
00098 virtual void updateLineJoin(GfxState *state);
00099 virtual void updateLineCap(GfxState *state);
00100 virtual void updateMiterLimit(GfxState *state);
00101 virtual void updateLineWidth(GfxState *state);
00102 virtual void updateFillColor(GfxState *state);
00103 virtual void updateStrokeColor(GfxState *state);
00104
00105
00106 virtual void updateFont(GfxState *state);
00107 virtual void updateTextMat(GfxState *state);
00108 virtual void updateCharSpace(GfxState *state);
00109 virtual void updateRender(GfxState *state);
00110 virtual void updateRise(GfxState *state);
00111 virtual void updateWordSpace(GfxState *state);
00112 virtual void updateHorizScaling(GfxState *state);
00113 virtual void updateTextPos(GfxState *state);
00114 virtual void updateTextShift(GfxState *state, double shift);
00115
00116
00117 virtual void stroke(GfxState *state);
00118 virtual void fill(GfxState *state);
00119 virtual void eoFill(GfxState *state);
00120
00121
00122 virtual void clip(GfxState *state);
00123 virtual void eoClip(GfxState *state);
00124
00125
00126 virtual void drawString(GfxState *state, GString *s);
00127
00128
00129 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
00130 int width, int height, GBool invert,
00131 GBool inlineImg);
00132 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
00133 int width, int height, GfxImageColorMap *colorMap,
00134 int *maskColors, GBool inlineImg);
00135
00136 #if OPI_SUPPORT
00137
00138 virtual void opiBegin(GfxState *state, Dict *opiDict);
00139 virtual void opiEnd(GfxState *state, Dict *opiDict);
00140 #endif
00141
00142
00143 virtual void type3D0(GfxState *state, double wx, double wy);
00144 virtual void type3D1(GfxState *state, double wx, double wy,
00145 double llx, double lly, double urx, double ury);
00146
00147
00148 virtual void psXObject(Stream *psStream, Stream *level1Stream);
00149
00150
00151 private:
00152
00153 void init(PSOutputFunc outputFuncA, void *outputStreamA,
00154 PSFileType fileTypeA, XRef *xrefA, Catalog *catalog,
00155 int firstPage, int lastPage, PSOutMode modeA);
00156 void setupResources(Dict *resDict);
00157 void setupFonts(Dict *resDict);
00158 void setupFont(GfxFont *font, Dict *parentResDict);
00159 void setupEmbeddedType1Font(Ref *id, char *psName);
00160 void setupExternalType1Font(GString *fileName, char *psName);
00161 void setupEmbeddedType1CFont(GfxFont *font, Ref *id, char *psName);
00162 void setupEmbeddedTrueTypeFont(GfxFont *font, Ref *id, char *psName);
00163 void setupExternalTrueTypeFont(GfxFont *font, char *psName);
00164 void setupEmbeddedCIDType0Font(GfxFont *font, Ref *id, char *psName);
00165 void setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id, char *psName);
00166 void setupType3Font(GfxFont *font, char *psName, Dict *parentResDict);
00167 void setupImages(Dict *resDict);
00168 void setupImage(Ref id, Stream *str);
00169 void addProcessColor(double c, double m, double y, double k);
00170 void addCustomColor(GfxSeparationColorSpace *sepCS);
00171 void doPath(GfxPath *path);
00172 void doImageL1(GfxImageColorMap *colorMap,
00173 GBool invert, GBool inlineImg,
00174 Stream *str, int width, int height, int len);
00175 void doImageL1Sep(GfxImageColorMap *colorMap,
00176 GBool invert, GBool inlineImg,
00177 Stream *str, int width, int height, int len);
00178 void doImageL2(Object *ref, GfxImageColorMap *colorMap,
00179 GBool invert, GBool inlineImg,
00180 Stream *str, int width, int height, int len);
00181 void dumpColorSpaceL2(GfxColorSpace *colorSpace);
00182 #if OPI_SUPPORT
00183 void opiBegin20(GfxState *state, Dict *dict);
00184 void opiBegin13(GfxState *state, Dict *dict);
00185 void opiTransform(GfxState *state, double x0, double y0,
00186 double *x1, double *y1);
00187 GBool getFileSpec(Object *fileSpec, Object *fileName);
00188 #endif
00189 void writePSChar(char c);
00190 void writePS(char *s);
00191 void writePSFmt(const char *fmt, ...);
00192 void writePSString(GString *s);
00193 void writePSName(char *s);
00194 GString *filterPSName(GString *name);
00195
00196 PSLevel level;
00197 PSOutMode mode;
00198 int paperWidth;
00199 int paperHeight;
00200
00201 PSOutputFunc outputFunc;
00202 void *outputStream;
00203 PSFileType fileType;
00204 int seqPage;
00205
00206 XRef *xref;
00207
00208 Ref *fontIDs;
00209 int fontIDLen;
00210 int fontIDSize;
00211 Ref *fontFileIDs;
00212 int fontFileIDLen;
00213 int fontFileIDSize;
00214 GString **fontFileNames;
00215 int fontFileNameLen;
00216 int fontFileNameSize;
00217 PSFont16Enc *font16Enc;
00218 int font16EncLen;
00219 int font16EncSize;
00220
00221 double tx, ty;
00222 double xScale, yScale;
00223 GBool landscape;
00224
00225 GString *embFontList;
00226
00227 int processColors;
00228 PSOutCustomColor
00229 *customColors;
00230
00231 GBool inType3Char;
00232 GString *t3String;
00233 double t3WX, t3WY,
00234 t3LLX, t3LLY, t3URX, t3URY;
00235 GBool t3Cacheable;
00236
00237 #if OPI_SUPPORT
00238 int opi13Nest;
00239 int opi20Nest;
00240 #endif
00241
00242 GBool ok;
00243
00244 };
00245
00246 #endif