diff options
author | Calvin Morrison <calvin@pobox.com> | 2023-04-05 14:13:39 -0400 |
---|---|---|
committer | Calvin Morrison <calvin@pobox.com> | 2023-04-05 14:13:39 -0400 |
commit | 835e373b3eeaabcd0621ed6798ab500f37982fae (patch) | |
tree | dfa16b0e2e1b4956b38f693220eac4e607802133 /xpdf/PreScanOutputDev.h |
Diffstat (limited to 'xpdf/PreScanOutputDev.h')
-rw-r--r-- | xpdf/PreScanOutputDev.h | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/xpdf/PreScanOutputDev.h b/xpdf/PreScanOutputDev.h new file mode 100644 index 0000000..ee21e98 --- /dev/null +++ b/xpdf/PreScanOutputDev.h @@ -0,0 +1,149 @@ +//======================================================================== +// +// PreScanOutputDev.h +// +// Copyright 2005 Glyph & Cog, LLC +// +//======================================================================== + +#ifndef PRESCANOUTPUTDEV_H +#define PRESCANOUTPUTDEV_H + +#include <aconf.h> + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "gtypes.h" +#include "GfxState.h" +#include "OutputDev.h" + +//------------------------------------------------------------------------ +// PreScanOutputDev +//------------------------------------------------------------------------ + +class PreScanOutputDev: public OutputDev { +public: + + // Constructor. + PreScanOutputDev(); + + // Destructor. + virtual ~PreScanOutputDev(); + + //----- get info about output device + + // Does this device use upside-down coordinates? + // (Upside-down means (0,0) is the top left corner of the page.) + virtual GBool upsideDown() { return gTrue; } + + // Does this device use drawChar() or drawString()? + virtual GBool useDrawChar() { return gTrue; } + + // Does this device use tilingPatternFill()? If this returns false, + // tiling pattern fills will be reduced to a series of other drawing + // operations. + virtual GBool useTilingPatternFill() { return gTrue; } + + // Does this device use beginType3Char/endType3Char? Otherwise, + // text in Type 3 fonts will be drawn with drawChar/drawString. + virtual GBool interpretType3Chars() { return gTrue; } + + //----- initialization and control + + // Start a page. + virtual void startPage(int pageNum, GfxState *state); + + // End a page. + virtual void endPage(); + + //----- path painting + virtual void stroke(GfxState *state); + virtual void fill(GfxState *state); + virtual void eoFill(GfxState *state); + virtual void tilingPatternFill(GfxState *state, Gfx *gfx, Object *strRef, + int paintType, int tilingType, Dict *resDict, + double *mat, double *bbox, + int x0, int y0, int x1, int y1, + double xStep, double yStep); + virtual GBool shadedFill(GfxState *state, GfxShading *shading); + + //----- path clipping + virtual void clip(GfxState *state); + virtual void eoClip(GfxState *state); + + //----- text drawing + virtual void beginStringOp(GfxState *state); + virtual void endStringOp(GfxState *state); + virtual GBool beginType3Char(GfxState *state, double x, double y, + double dx, double dy, + CharCode code, Unicode *u, int uLen); + virtual void endType3Char(GfxState *state); + + //----- image drawing + virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, + int width, int height, GBool invert, + GBool inlineImg, GBool interpolate); + virtual void drawImage(GfxState *state, Object *ref, Stream *str, + int width, int height, GfxImageColorMap *colorMap, + int *maskColors, GBool inlineImg, GBool interpolate); + virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, + int width, int height, + GfxImageColorMap *colorMap, + Object *maskRef, Stream *maskStr, + int maskWidth, int maskHeight, + GBool maskInvert, GBool interpolate); + virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, + int width, int height, + GfxImageColorMap *colorMap, + Object *maskRef, Stream *maskStr, + int maskWidth, int maskHeight, + GfxImageColorMap *maskColorMap, + double *matte, GBool interpolate); + + //----- transparency groups and soft masks + virtual GBool beginTransparencyGroup(GfxState *state, double *bbox, + GfxColorSpace *blendingColorSpace, + GBool isolated, GBool knockout, + GBool forSoftMask); + + //----- special access + + // Returns true if the operations performed since the last call to + // clearStats() are all monochrome (black or white). + GBool isMonochrome() { return mono; } + + // Returns true if the operations performed since the last call to + // clearStats() are all gray. + GBool isGray() { return gray; } + + // Returns true if the operations performed since the last call to + // clearStats() included any transparency. + GBool usesTransparency() { return transparency; } + + // Returns true if the operations performed since the last call to + // clearStats() included any image mask fills with a pattern color + // space. + GBool usesPatternImageMask() { return patternImgMask; } + + // Returns true if the operations performed since the last call to + // clearStats() are all rasterizable by GDI calls in GDIOutputDev. + GBool isAllGDI() { return gdi; } + + // Clear the stats used by the above functions. + void clearStats(); + +private: + + void check(GfxState *state, GfxColorSpace *colorSpace, GfxColor *color, + double opacity, GfxBlendMode blendMode); + + GBool mono; + GBool gray; + GBool transparency; + GBool patternImgMask; + GBool gdi; +}; + +#endif |