File indexing completed on 2024-12-29 04:50:59
0001 /* 0002 SPDX-FileCopyrightText: 2019 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "pdfimage.h" 0010 #include "pdflink.h" 0011 #include "pdfvectorpicture_p.h" 0012 #include "popplertypes_p.h" 0013 0014 #include <TextOutputDev.h> 0015 0016 #include <vector> 0017 0018 namespace KItinerary { 0019 0020 class PdfImage; 0021 class PdfVectorPicture; 0022 0023 class PdfExtractorOutputDevice : public TextOutputDev 0024 { 0025 public: 0026 explicit PdfExtractorOutputDevice(); 0027 0028 // call once displaying has been completed 0029 void finalize(); 0030 0031 // raster image operations 0032 bool needNonText() override { return true; } 0033 void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, bool invert, bool interpolate, bool inlineImg) override; 0034 void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, bool interpolate, PopplerMaskColors *maskColors, bool inlineImg) override; 0035 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; 0036 0037 // operations used to detect vector barcodes 0038 void saveState(GfxState *state) override; 0039 void restoreState(GfxState *state) override; 0040 void stroke(GfxState *state) override; 0041 void fill(GfxState *state) override; 0042 void eoFill(GfxState *state) override; 0043 0044 // links 0045 void processLink(AnnotLink *link) override; 0046 0047 void addRasterImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, PdfImageType type); 0048 void addVectorImage(const PdfVectorPicture &pic); 0049 0050 // extracted images 0051 std::vector<PdfImage> m_images; 0052 0053 // intermediate vector state 0054 struct VectorOp { 0055 enum { Path, PushState, PopState } type; 0056 QTransform transform; 0057 PdfVectorPicture::PathStroke stroke; 0058 }; 0059 std::vector<VectorOp> m_vectorOps; 0060 0061 // extracted links 0062 std::vector<PdfLink> m_links; 0063 }; 0064 0065 } 0066