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