1 | //======================================================================== |
2 | // |
3 | // BBoxOutputDev.cc |
4 | // |
5 | // This file is licensed under the GPLv2 or later |
6 | // |
7 | // Copyright 2020 sgerwk <sgerwk@aol.com> |
8 | // |
9 | //======================================================================== |
10 | |
11 | #include <PDFDoc.h> |
12 | #include <GfxState.h> |
13 | #include <OutputDev.h> |
14 | |
15 | class POPPLER_PRIVATE_EXPORT BBoxOutputDev : public OutputDev |
16 | { |
17 | public: |
18 | bool upsideDown() override { return false; } |
19 | bool useDrawChar() override { return true; } |
20 | bool interpretType3Chars() override { return false; } |
21 | |
22 | BBoxOutputDev(); |
23 | BBoxOutputDev(bool text, bool vector, bool raster); |
24 | BBoxOutputDev(bool text, bool vector, bool raster, bool lwidth); |
25 | void endPage() override; |
26 | void stroke(GfxState *state) override; |
27 | void fill(GfxState *state) override; |
28 | void eoFill(GfxState *state) override; |
29 | void drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, CharCode code, int nBytes, const Unicode *u, int uLen) override; |
30 | void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, bool invert, bool interpolate, bool inlineImg) override; |
31 | void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, bool interpolate, const int *maskColors, bool inlineImg) override; |
32 | 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; |
33 | void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, |
34 | bool maskInterpolate) override; |
35 | |
36 | double getX1() const; |
37 | double getY1() const; |
38 | double getX2() const; |
39 | double getY2() const; |
40 | double getHasGraphics() const; |
41 | |
42 | private: |
43 | PDFRectangle bb; |
44 | bool hasGraphics; |
45 | |
46 | bool text; |
47 | bool vector; |
48 | bool raster; |
49 | bool lwidth; |
50 | |
51 | void updatePoint(PDFRectangle *bbA, double x, double y, const GfxState *state); |
52 | void updatePath(PDFRectangle *bbA, const GfxPath *path, const GfxState *state); |
53 | void updateImage(PDFRectangle *bbA, const GfxState *state); |
54 | }; |
55 | |