lib

KoPictureImage.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 __koPictureImage_h__
21#define __koPictureImage_h__
22
23#include "KoPictureBase.h"
24#include <tqstring.h>
25
26class KoPictureImagePrivate;
27// TODO: fix documentation
28
34class KoPictureImage : public KoPictureBase
35{
36public:
40 KoPictureImage();
41
45 virtual ~KoPictureImage();
46
47 KoPictureType::Type getType(void) const;
48
49 KoPictureBase* newCopy(void) const;
50
54 virtual bool isNull(void) const;
55
74 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);
75
76 virtual TQDragObject* dragObject( TQWidget *dragSource = 0L, const char *name = 0L );
77
78 virtual bool loadData(const TQByteArray& array, const TQString& extension);
79
80 virtual bool save(TQIODevice* io) const;
81
82 virtual TQSize getOriginalSize(void) const;
83
84 virtual TQPixmap generatePixmap(const TQSize& size, bool smoothScale = false);
85
86 virtual TQString getMimeType(const TQString& extension) const;
87
92 virtual TQImage generateImage(const TQSize& size);
93
94 virtual bool hasAlphaBuffer() const
95 { return m_originalImage.hasAlphaBuffer(); }
96
97 virtual void setAlphaBuffer(bool enable)
98 { m_originalImage.setAlphaBuffer(enable); }
99
100 virtual TQImage createAlphaMask(int conversion_flags = 0) const
101 { return m_originalImage.createAlphaMask((TQt::ImageConversionFlags)conversion_flags); }
102
103 virtual void clearCache(void);
104
105protected:
106 TQPixmap getPixmap(TQImage& image);
107 void scaleAndCreatePixmap(const TQSize& size, bool fastMode=false);
108
109private:
110 TQImage m_originalImage;
111 TQByteArray m_rawData;
112 TQPixmap m_cachedPixmap;
113 TQSize m_cachedSize;
118 bool m_cacheIsInFastMode;
119 class Private;
120 Private* d;
121};
122
123#endif /* __koPictureImage_h__ */