beta-0.89.2
[luatex.git] / source / libs / poppler / poppler-src / poppler / PreScanOutputDev.h
blob50fcbf22f73da39d6579058810f850e23fc60858
1 //========================================================================
2 //
3 // PreScanOutputDev.h
4 //
5 // Copyright 2005 Glyph & Cog, LLC
6 //
7 //========================================================================
9 //========================================================================
11 // Modified under the Poppler project - http://poppler.freedesktop.org
13 // All changes made under the Poppler project to this file are licensed
14 // under GPL version 2 or later
16 // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
17 // Copyright (C) 2010 Albert Astals Cid <aacid@kde.org>
18 // Copyright (C) 2011, 2014 William Bader <williambader@hotmail.com>
19 // Copyright (C) 2011, 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
20 // Copyright (C) 2011 Adrian Johnson <ajohnson@redneon.com>
22 // To see a description of the changes please see the Changelog file that
23 // came with your tarball or type make ChangeLog if you are building from git
25 //========================================================================
27 #ifndef PRESCANOUTPUTDEV_H
28 #define PRESCANOUTPUTDEV_H
30 #ifdef USE_GCC_PRAGMAS
31 #pragma interface
32 #endif
34 #include "goo/gtypes.h"
35 #include "Object.h"
36 #include "GfxState.h"
37 #include "GlobalParams.h"
38 #include "OutputDev.h"
40 //------------------------------------------------------------------------
41 // PreScanOutputDev
42 //------------------------------------------------------------------------
44 class PreScanOutputDev: public OutputDev {
45 public:
47 // Constructor.
48 PreScanOutputDev(PDFDoc *docA);
50 // Destructor.
51 virtual ~PreScanOutputDev();
53 //----- get info about output device
55 // Does this device use upside-down coordinates?
56 // (Upside-down means (0,0) is the top left corner of the page.)
57 virtual GBool upsideDown() { return gTrue; }
59 // Does this device use drawChar() or drawString()?
60 virtual GBool useDrawChar() { return gTrue; }
62 // Does this device use tilingPatternFill()? If this returns false,
63 // tiling pattern fills will be reduced to a series of other drawing
64 // operations.
65 virtual GBool useTilingPatternFill() { return gTrue; }
67 // Does this device use functionShadedFill(), axialShadedFill(), and
68 // radialShadedFill()? If this returns false, these shaded fills
69 // will be reduced to a series of other drawing operations.
70 virtual GBool useShadedFills(int type) { return gTrue; }
72 // Does this device use beginType3Char/endType3Char? Otherwise,
73 // text in Type 3 fonts will be drawn with drawChar/drawString.
74 virtual GBool interpretType3Chars() { return gTrue; }
76 //----- initialization and control
78 // Start a page.
79 virtual void startPage(int pageNum, GfxState *state, XRef *xref);
81 // End a page.
82 virtual void endPage();
84 //----- path painting
85 virtual void stroke(GfxState *state);
86 virtual void fill(GfxState *state);
87 virtual void eoFill(GfxState *state);
88 virtual GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str,
89 double *pmat, int paintType, int tilingType, Dict *resDict,
90 double *mat, double *bbox,
91 int x0, int y0, int x1, int y1,
92 double xStep, double yStep);
93 virtual GBool functionShadedFill(GfxState *state,
94 GfxFunctionShading *shading);
95 virtual GBool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax);
96 virtual GBool radialShadedFill(GfxState *state, GfxRadialShading *shading, double tMin, double tMax);
98 //----- path clipping
99 virtual void clip(GfxState *state);
100 virtual void eoClip(GfxState *state);
102 //----- text drawing
103 virtual void beginStringOp(GfxState *state);
104 virtual void endStringOp(GfxState *state);
105 virtual GBool beginType3Char(GfxState *state, double x, double y,
106 double dx, double dy,
107 CharCode code, Unicode *u, int uLen);
108 virtual void endType3Char(GfxState *state);
110 //----- image drawing
111 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
112 int width, int height, GBool invert,
113 GBool interpolate, GBool inlineImg);
114 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
115 int width, int height, GfxImageColorMap *colorMap,
116 GBool interpolate, int *maskColors, GBool inlineImg);
117 virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
118 int width, int height,
119 GfxImageColorMap *colorMap,
120 GBool interpolate,
121 Stream *maskStr, int maskWidth, int maskHeight,
122 GBool maskInvert, GBool maskInterpolate);
123 virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
124 int width, int height,
125 GfxImageColorMap *colorMap,
126 GBool interpolate,
127 Stream *maskStr,
128 int maskWidth, int maskHeight,
129 GfxImageColorMap *maskColorMap,
130 GBool maskInterpolate);
132 //----- transparency groups and soft masks
133 virtual void beginTransparencyGroup(GfxState *state, double *bbox,
134 GfxColorSpace *blendingColorSpace,
135 GBool isolated, GBool knockout,
136 GBool forSoftMask);
137 virtual void paintTransparencyGroup(GfxState *state, double *bbox);
138 virtual void setSoftMask(GfxState *state, double *bbox, GBool alpha,
139 Function *transferFunc, GfxColor *backdropColor);
141 //----- special access
143 // Returns true if the operations performed since the last call to
144 // clearStats() are all monochrome (black or white).
145 GBool isMonochrome() { return mono; }
147 // Returns true if the operations performed since the last call to
148 // clearStats() are all gray.
149 GBool isGray() { return gray; }
151 // Returns true if the operations performed since the last call to
152 // clearStats() included any transparency.
153 GBool usesTransparency() { return transparency; }
155 // Returns true if the operations performed since the last call to
156 // clearStats() are all rasterizable by GDI calls in GDIOutputDev.
157 GBool isAllGDI() { return gdi; }
159 // Returns true if the operations performed since the last call to
160 // clearStats() included any image mask fills with a pattern color
161 // space. (only level1!)
162 GBool usesPatternImageMask() { return patternImgMask; }
164 // Clear the stats used by the above functions.
165 void clearStats();
167 private:
169 void check(GfxColorSpace *colorSpace, GfxColor *color,
170 double opacity, GfxBlendMode blendMode);
172 PDFDoc *doc;
173 GBool mono;
174 GBool gray;
175 GBool transparency;
176 GBool gdi;
177 PSLevel level; // PostScript level (1, 2, separation)
178 GBool patternImgMask;
179 int inTilingPatternFill;
182 #endif