lib

KoPictureEps.h
1/* This file is part of the KDE project
2 Copyright (c) 2001 Simon Hausmann <hausmann@kde.org>
3 Copyright (C) 2002, 2003, 2004 Nicolas GOUTTE <goutte@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20#ifndef __koPictureEps_h__
21#define __koPictureEps_h__
22
23#include <tqstring.h>
24
25class TQPainter;
26class TQSize;
27class KoPictureEpsPrivate;
28
29// TODO: fix documentation
30
35class KoPictureEps : public KoPictureBase
36{
37public:
41 KoPictureEps();
42
46 virtual ~KoPictureEps();
47
48 KoPictureType::Type getType(void) const;
49
50 KoPictureBase* newCopy(void) const;
51
55 virtual bool isNull(void) const;
56
75 virtual void draw(TQPainter& painter, int x, int y, int width, int height, int sx = 0, int sy = 0, int sw = -1, int sh = -1, bool fastMode = false);
76
77 virtual bool loadData(const TQByteArray& array, const TQString& extension);
78
79 virtual bool save(TQIODevice* io) const;
80
81 virtual TQSize getOriginalSize(void) const;
82
83 virtual TQPixmap generatePixmap(const TQSize& size, bool smoothScale = false);
84
85 virtual TQString getMimeType(const TQString& extension) const;
86
91 virtual TQImage generateImage(const TQSize& size);
92
93 virtual void clearCache(void);
94protected:
95 TQPixmap getPixmap(TQImage& image);
96 void scaleAndCreatePixmap(const TQSize& size, bool fastMode, const int resolutionx, const int resolutiony );
97 TQImage scaleWithGhostScript( const TQSize& size, const int resolutionx, const int resolutiony );
98 bool extractPostScriptStream( void );
99
100private:
101 int tryScaleWithGhostScript(TQImage &image, const TQSize& size, const int resolutionx, const int resolutiony, const char* device );
116 TQString readLine( const TQByteArray& array, const uint start, const uint length, uint& pos, bool& lastCharWasCr );
117
118private:
122 TQByteArray m_rawData;
123 TQPixmap m_cachedPixmap;
124 TQSize m_originalSize;
125 TQSize m_cachedSize;
126 TQRect m_boundingBox;
127 uint m_psStreamStart;
128 uint m_psStreamLength;
133 bool m_cacheIsInFastMode;
134};
135
136#endif /* __koPictureEps_h__ */