KoPicture.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 __koPicture_h__
21#define __koPicture_h__
22
23#include <tqstring.h>
24#include <tqiodevice.h>
25#include <tqpixmap.h>
26#include <koffice_export.h>
27
28#include "KoPictureKey.h"
29
30class KoXmlWriter;
31class TQPainter;
32class TQSize;
33class TQDragObject;
34class KURL;
35
36class KoPictureShared;
37
43class KOFFICECORE_EXPORT KoPicture
44{
45public:
49 KoPicture(void);
50
54 ~KoPicture(void);
55
59 KoPicture(const KoPicture &other);
60
64 KoPicture& operator=(const KoPicture& other);
65
66 KoPictureType::Type getType(void) const;
67
71 KoPictureKey getKey(void) const;
72
76 void setKey(const KoPictureKey& key);
77
81 bool isNull(void) const;
82
97 void draw(TQPainter& painter, int x, int y, int width, int height, int sx = 0, int sy = 0,
98 int sw = -1, int sh = -1, bool fastMode = false);
99
106 TQDragObject* dragObject( TQWidget *dragSource = 0L, const char *name = 0L );
107
108 bool load(TQIODevice* io, const TQString& extension);
109
114 bool save(TQIODevice* io) const;
115
126 bool saveAsBase64( KoXmlWriter& writer ) const;
127
131 TQString getExtension(void) const;
132
136 TQString getMimeType(void) const;
137
141 TQSize getOriginalSize(void) const;
142
148 void clearAndSetMode(const TQString& newMode);
149
153 void clear(void);
154
158 bool loadFromFile(const TQString& fileName);
159
163 bool loadFromBase64(const TQCString& str);
164
168 bool loadXpm(TQIODevice* io);
169
176 TQPixmap generatePixmap(const TQSize& size, bool smoothScale = false);
177
186 bool setKeyAndDownloadPicture(const KURL& url, TQWidget *window);
187
194 TQImage generateImage(const TQSize& size);
195
199 bool hasAlphaBuffer() const;
200
204 void setAlphaBuffer(bool enable);
205
212 TQImage createAlphaMask(int conversion_flags = 0) const;
213
220 void clearCache(void);
221
222 TQString uniquePictureId() const;
223 void assignPictureId( uint _id);
224
225protected:
230 void unlinkSharedData(void);
235 void linkSharedData(void) const;
240 void createSharedData(void);
241 TQString uniqueName() const;
242
243protected:
248 KoPictureKey m_key;
253 KoPictureShared* m_sharedData;
254 static uint uniqueValue;
255
256 TQString m_uniqueName;
257};
258
259#endif /* __koPicture_h__ */
KoPictureKey is the structure describing a picture in a unique way.
KoPicture is a container class for various types of pictures supported by KOffice.
Definition KoPicture.h:44
A class for writing out XML (to any TQIODevice), with a special attention on performance.
Definition KoXmlWriter.h:37