lib

KoPictureBase.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 __koPictureBase_h__
21#define __koPictureBase_h__
22
23#include "KoPictureKey.h" // for KoPictureType
24
25#include <tqstring.h>
26#include <tqimage.h>
27
28class KoXmlWriter;
29class TQPainter;
30class TQSize;
31class TQIODevice;
32class TQDragObject;
33
34const char NULL_MIME_TYPE[]="application/x-zerosize";
35
36// TODO: fix documentation
37
42class KoPictureBase
43{
44public:
48 KoPictureBase();
49
53 virtual ~KoPictureBase();
54
55 virtual KoPictureType::Type getType(void) const;
56
57 virtual KoPictureBase* newCopy(void) const;
58
62 virtual bool isNull(void) const;
63
79 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);
80
86 virtual TQDragObject* dragObject( TQWidget *dragSource = 0L, const char *name = 0L );
87
88 virtual bool load(TQIODevice* io, const TQString& extension);
89
90 virtual bool loadData(const TQByteArray& array, const TQString& extension);
91
96 virtual bool save(TQIODevice* io) const;
97
102 virtual bool saveAsBase64( KoXmlWriter& writer ) const;
103
104 virtual TQSize getOriginalSize(void) const;
105
106 virtual TQPixmap generatePixmap(const TQSize& size, bool smoothScale = false);
107
108 virtual TQString getMimeType(const TQString& extension) const;
109
110 bool isSlowResizeModeAllowed(void) const;
111
116 virtual TQImage generateImage(const TQSize& size);
117
118 virtual bool hasAlphaBuffer() const
119 { return false; }
120 virtual void setAlphaBuffer(bool /*enable*/)
121 { }
122 virtual TQImage createAlphaMask(int /*conversion_flags*/ = 0) const
123 { return TQImage(); }
124
125 virtual void clearCache(void);
126};
127
128#endif /* __koPictureBase_h__ */
A class for writing out XML (to any TQIODevice), with a special attention on performance.
Definition KoXmlWriter.h:37