lib

KoPictureShared.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 __koPictureShared_h__
21#define __koPictureShared_h__
22
23#include <tqshared.h>
24#include <tqstring.h>
25#include <tqiodevice.h>
26#include <tqpixmap.h>
27
28#include "KoPictureKey.h"
29
30class KoXmlWriter;
31class TQPainter;
32class TQSize;
33
34class KURL;
35
36class KoPictureBase;
37
44class KoPictureShared : public TQShared
45{
46public:
50 KoPictureShared(void);
51
55 ~KoPictureShared(void);
56
62 KoPictureShared(const KoPictureShared &other);
63
69 KoPictureShared& operator=(const KoPictureShared& other);
70
71 KoPictureType::Type getType(void) const;
72
76 bool isNull(void) const;
77
91 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);
92
98 TQDragObject* dragObject( TQWidget *dragSource = 0L, const char *name = 0L );
99
100 bool load(TQIODevice* io, const TQString& extension);
101 bool loadFromBase64( const TQCString& str );
102
107 bool save(TQIODevice* io) const;
108
113 bool saveAsBase64( KoXmlWriter& writer ) const;
114
115 void setExtension(const TQString& extension);
116
117 TQString getExtension(void) const;
118
119 TQSize getOriginalSize(void) const;
120
126 void clearAndSetMode(const TQString& newMode);
127
131 void clear(void);
132
138 bool loadFromFile(const TQString& fileName);
139
143 bool loadXpm(TQIODevice* io);
144
151 TQPixmap generatePixmap(const TQSize& size, bool smoothScale = false);
152
153 TQString getMimeType(void) const;
154
162 TQImage generateImage(const TQSize& size);
163
164 bool hasAlphaBuffer() const;
165 void setAlphaBuffer(bool enable);
166 TQImage createAlphaMask(int conversion_flags = 0) const;
167
174 void clearCache(void);
175
176 TQString uniquePictureId() const;
177 void assignPictureId( uint _id);
178
179protected:
185 bool loadWmf(TQIODevice* io);
186
191 bool loadTmp(TQIODevice* io);
192
194 bool identifyAndLoad( TQByteArray data );
195
206 bool loadCompressed( TQIODevice* io, const TQString& mimeType, const TQString& extension );
207
208protected:
209 KoPictureBase* m_base;
210 TQString m_extension;
211 uint m_pictureId;
212};
213
214#endif /* __koPictureShared_h__ */
A class for writing out XML (to any TQIODevice), with a special attention on performance.
Definition KoXmlWriter.h:37