Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-10 10:23:50

0001 //========================================================================
0002 //
0003 // PreScanOutputDev.h
0004 //
0005 // Copyright 2005 Glyph & Cog, LLC
0006 //
0007 //========================================================================
0008 
0009 //========================================================================
0010 //
0011 // Modified under the Poppler project - http://poppler.freedesktop.org
0012 //
0013 // All changes made under the Poppler project to this file are licensed
0014 // under GPL version 2 or later
0015 //
0016 // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
0017 // Copyright (C) 2010, 2018-2021 Albert Astals Cid <aacid@kde.org>
0018 // Copyright (C) 2011, 2014 William Bader <williambader@hotmail.com>
0019 // Copyright (C) 2011, 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
0020 // Copyright (C) 2011 Adrian Johnson <ajohnson@redneon.com>
0021 //
0022 // To see a description of the changes please see the Changelog file that
0023 // came with your tarball or type make ChangeLog if you are building from git
0024 //
0025 //========================================================================
0026 
0027 #ifndef PRESCANOUTPUTDEV_H
0028 #define PRESCANOUTPUTDEV_H
0029 
0030 #include "Object.h"
0031 #include "GfxState.h"
0032 #include "OutputDev.h"
0033 #include "PSOutputDev.h"
0034 
0035 //------------------------------------------------------------------------
0036 // PreScanOutputDev
0037 //------------------------------------------------------------------------
0038 
0039 class PreScanOutputDev : public OutputDev
0040 {
0041 public:
0042     // Constructor.
0043     explicit PreScanOutputDev(PSLevel levelA);
0044 
0045     // Destructor.
0046     ~PreScanOutputDev() override;
0047 
0048     //----- get info about output device
0049 
0050     // Does this device use upside-down coordinates?
0051     // (Upside-down means (0,0) is the top left corner of the page.)
0052     bool upsideDown() override { return true; }
0053 
0054     // Does this device use drawChar() or drawString()?
0055     bool useDrawChar() override { return true; }
0056 
0057     // Does this device use tilingPatternFill()?  If this returns false,
0058     // tiling pattern fills will be reduced to a series of other drawing
0059     // operations.
0060     bool useTilingPatternFill() override { return true; }
0061 
0062     // Does this device use functionShadedFill(), axialShadedFill(), and
0063     // radialShadedFill()?  If this returns false, these shaded fills
0064     // will be reduced to a series of other drawing operations.
0065     bool useShadedFills(int type) override { return true; }
0066 
0067     // Does this device use beginType3Char/endType3Char?  Otherwise,
0068     // text in Type 3 fonts will be drawn with drawChar/drawString.
0069     bool interpretType3Chars() override { return true; }
0070 
0071     //----- initialization and control
0072 
0073     // Start a page.
0074     void startPage(int pageNum, GfxState *state, XRef *xref) override;
0075 
0076     // End a page.
0077     void endPage() override;
0078 
0079     //----- path painting
0080     void stroke(GfxState *state) override;
0081     void fill(GfxState *state) override;
0082     void eoFill(GfxState *state) override;
0083     bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, GfxTilingPattern *tPat, const double *mat, int x0, int y0, int x1, int y1, double xStep, double yStep) override;
0084     bool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override;
0085     bool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) override;
0086     bool radialShadedFill(GfxState *state, GfxRadialShading *shading, double tMin, double tMax) override;
0087 
0088     //----- path clipping
0089     void clip(GfxState *state) override;
0090     void eoClip(GfxState *state) override;
0091 
0092     //----- text drawing
0093     void beginStringOp(GfxState *state) override;
0094     void endStringOp(GfxState *state) override;
0095     bool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, const Unicode *u, int uLen) override;
0096     void endType3Char(GfxState *state) override;
0097 
0098     //----- image drawing
0099     void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, bool invert, bool interpolate, bool inlineImg) override;
0100     void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, bool interpolate, const int *maskColors, bool inlineImg) override;
0101     void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, bool maskInvert, bool maskInterpolate) override;
0102     void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap,
0103                              bool maskInterpolate) override;
0104 
0105     //----- transparency groups and soft masks
0106     void beginTransparencyGroup(GfxState *state, const double *bbox, GfxColorSpace *blendingColorSpace, bool isolated, bool knockout, bool forSoftMask) override;
0107     void paintTransparencyGroup(GfxState *state, const double *bbox) override;
0108     void setSoftMask(GfxState *state, const double *bbox, bool alpha, Function *transferFunc, GfxColor *backdropColor) override;
0109 
0110     //----- special access
0111 
0112     // Returns true if the operations performed since the last call to
0113     // clearStats() are all monochrome (black or white).
0114     bool isMonochrome() { return mono; }
0115 
0116     // Returns true if the operations performed since the last call to
0117     // clearStats() are all gray.
0118     bool isGray() { return gray; }
0119 
0120     // Returns true if the operations performed since the last call to
0121     // clearStats() included any transparency.
0122     bool usesTransparency() { return transparency; }
0123 
0124     // Returns true if the operations performed since the last call to
0125     // clearStats() are all rasterizable by GDI calls in GDIOutputDev.
0126     bool isAllGDI() { return gdi; }
0127 
0128     // Returns true if the operations performed since the last call to
0129     // clearStats() included any image mask fills with a pattern color
0130     // space. (only level1!)
0131     bool usesPatternImageMask() { return patternImgMask; }
0132 
0133     // Clear the stats used by the above functions.
0134     void clearStats();
0135 
0136 private:
0137     void check(GfxColorSpace *colorSpace, const GfxColor *color, double opacity, GfxBlendMode blendMode);
0138 
0139     bool mono;
0140     bool gray;
0141     bool transparency;
0142     bool gdi;
0143     PSLevel level; // PostScript level (1, 2, separation)
0144     bool patternImgMask;
0145     int inTilingPatternFill;
0146 };
0147 
0148 #endif