F:/KPlato/koffice/libs/kofficecore/KoPictureImage.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002    Copyright (c) 2001 Simon Hausmann <hausmann@kde.org>
00003    Copyright (C) 2002, 2003, 2004 Nicolas GOUTTE <goutte@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 #ifndef __koPictureImage_h__
00021 #define __koPictureImage_h__
00022 
00023 #include "KoPictureBase.h"
00024 #include <QString>
00025 #include <QPixmap>
00026 
00027 class KoPictureImagePrivate;
00028 // TODO: fix documentation
00029 
00035 class KoPictureImage : public KoPictureBase
00036 {
00037 public:
00041     KoPictureImage();
00042 
00046     virtual ~KoPictureImage();
00047 
00048     KoPictureType::Type getType(void) const;
00049 
00050     KoPictureBase* newCopy(void) const;
00051 
00055     virtual bool isNull(void) const;
00056 
00075     virtual void draw(QPainter& painter, int x, int y, int width, int height, int sx = 0, int sy = 0, int sw = -1, int sh = -1, bool fastMode = false);
00076 
00077     virtual Q3DragObject* dragObject( QWidget *dragSource = 0L, const char *name = 0L );
00078 
00079     virtual bool loadData(const QByteArray& array, const QString& extension);
00080 
00081     virtual bool save(QIODevice* io) const;
00082 
00083     virtual QSize getOriginalSize(void) const;
00084 
00085     virtual QPixmap generatePixmap(const QSize& size, bool smoothScale = false);
00086 
00087     virtual QString getMimeType(const QString& extension) const;
00088 
00093     virtual QImage generateImage(const QSize& size);
00094 
00095     // TODO: Rename to hasAlphaChannel() ?
00096     virtual bool hasAlphaBuffer() const
00097         { return m_originalImage.hasAlphaChannel(); }
00098 
00099     // TODO: Rename to setAlphaChannel() ?
00100     virtual void setAlphaBuffer(bool enable)
00101         {   if(enable) 
00102             {
00103                 m_originalImage.convertToFormat(QImage::Format_ARGB32);
00104             }
00105             else 
00106             {
00107                 m_originalImage.convertToFormat(QImage::Format_RGB32);
00108             }
00109         }
00110 
00111     virtual QImage createAlphaMask(Qt::ImageConversionFlags flags = Qt::AutoColor) const
00112         { return m_originalImage.createAlphaMask(flags); }
00113 
00114     virtual void clearCache(void);
00115 
00116 protected:
00117     QPixmap getPixmap(QImage& image);
00118     void scaleAndCreatePixmap(const QSize& size, bool fastMode=false);
00119 
00120 private:
00121     QImage  m_originalImage; 
00122     QByteArray m_rawData; 
00123     QPixmap m_cachedPixmap; 
00124     QSize m_cachedSize; 
00125 
00129     bool m_cacheIsInFastMode;
00130     class Private;
00131     Private* d;
00132 };
00133 
00134 #endif /* __koPictureImage_h__ */

Généré le Wed Nov 22 23:41:03 2006 pour KPlato par  doxygen 1.5.1-p1