filters

FilterDevice.h
1/*
2 * Copyright (c) 2002 Nicolas HADACEK (hadacek@kde.org)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#ifndef FILTERDEVICE_H
21#define FILTERDEVICE_H
22
23#include <tqimage.h>
24
25class Object;
26class Stream;
27
28#include "gtypes.h"
29#include "OutputDev.h"
30
31#include "misc.h"
32
33
34namespace PDFImport
35{
36class Page;
37class Data;
38
39class Device : public OutputDev
40{
41public:
42 Device(Data &data);
43 ~Device();
44
45 void init();
46 void dumpPage(uint i);
47
48 //-----
49 virtual GBool upsideDown() { return gTrue; }
50 virtual GBool useDrawChar() { return gTrue; }
51 virtual GBool interpretType3Chars() { return gFalse; }
52 virtual GBool needNonText() { return gFalse; }
53
54 //----- initialization
55 virtual void startPage(int pageNum, GfxState *state);
56 virtual void endPage();
57
58 //----- update graphics state
59 virtual void updateAll(GfxState *state);
60// virtual void updateLineDash(GfxState *state);
61// virtual void updateFlatness(GfxState *state);
62// virtual void updateLineJoin(GfxState *state);
63// virtual void updateLineCap(GfxState *state);
64// virtual void updateMiterLimit(GfxState *state);
65// virtual void updateLineWidth(GfxState *state);
66 virtual void updateFillColor(GfxState *state);
67 virtual void updateStrokeColor(GfxState *state);
68
69 //----- update text state
70 virtual void updateFont(GfxState *state);
71
72 //----- text drawing
73 virtual void beginString(GfxState *state, GString *s);
74 virtual void endString(GfxState *state);
75 virtual void drawChar(GfxState *state, double x, double y,
76 double dx, double dy,
77 double originX, double originY,
78 CharCode c, Unicode *u, int uLen);
79
80 //----- link borders
81 virtual void drawLink(::Link* link, Catalog *cat);
82
83 //----- image drawing
84 virtual void drawImageMask(GfxState *, Object *ref, Stream *,
85 int width, int height, GBool invert,
86 GBool inlineImg);
87 virtual void drawImage(GfxState *, Object *ref, Stream *,
88 int width, int height, GfxImageColorMap *colorMap,
89 int *maskColors, GBool inlineImg);
90
91 //----- path painting
92 virtual void stroke(GfxState *state);
93 virtual void fill(GfxState *state);
94 virtual void eoFill(GfxState *state);
95
96private:
97 class Image;
98 static void computeGeometry(GfxState *, Image &);
99 uint initImage(GfxState *, int width, int height, bool mask);
100 void addImage();
101 void clear();
102 static DPathVector convertPath(GfxState *);
103 void doFill(const DPathVector &);
104 Page *current() const { return _pages.getLast(); }
105
106private:
107 Data &_data;
108 TQPtrList<Page> _pages;
109 TQColor _fillColor, _strokeColor;
110
111 class Image {
112 public:
113 TQImage image;
114 DRect rect;
115 bool mask;
116 };
117 Image _currentImage;
118 typedef TQValueList<Image> ImageList;
119 ImageList _images;
120};
121
122} // namespace
123
124#endif