lib Library API Documentation

koPicture.h

00001 /* This file is part of the KDE project
00002    Copyright (c) 2001 Simon Hausmann <hausmann@kde.org>
00003    Copyright (C) 2002, 2003 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., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */
00020 #ifndef __koPicture_h__
00021 #define __koPicture_h__
00022 
00023 #include <qstring.h>
00024 #include <qiodevice.h>
00025 #include <qpixmap.h>
00026 
00027 #include "koPictureKey.h"
00028 
00029 class QPainter;
00030 class QSize;
00031 class QDragObject;
00032 class KURL;
00033 
00034 class KoPictureShared;
00035 
00041 class KoPicture
00042 {
00043 public:
00047     KoPicture(void);
00048 
00052     ~KoPicture(void);
00053 
00057     KoPicture(const KoPicture &other);
00058 
00062     KoPicture& operator=(const KoPicture& other);
00063 
00064     KoPictureType::Type getType(void) const;
00065 
00069     KoPictureKey getKey(void) const;
00070 
00074     void setKey(const KoPictureKey& key);
00075 
00079     bool isNull(void) const;
00080 
00095     void draw(QPainter& painter, int x, int y, int width, int height, int sx = 0, int sy = 0,
00096               int sw = -1, int sh = -1, bool fastMode = false);
00097 
00103     QDragObject* dragObject( QWidget *dragSource = 0L, const char *name = 0L );
00104 
00105     bool load(QIODevice* io, const QString& extension);
00106 
00111     bool save(QIODevice* io);
00112 
00116     bool saveAsKOffice1Dot1(QIODevice* io);
00117 
00121     QString getExtension(void) const;
00122 
00126     QString getMimeType(void) const;
00127 
00128     QString getExtensionAsKOffice1Dot1(void) const;
00129 
00133     QSize getOriginalSize(void) const;
00134 
00140     void clearAndSetMode(const QString& newMode);
00141 
00145     void clear(void);
00146 
00150     bool loadFromFile(const QString& fileName);
00151 
00155     bool loadXpm(QIODevice* io);
00156 
00164     QPixmap generatePixmap(const QSize& size, bool smoothScale = false);
00165 
00170     bool isClipartAsKOffice1Dot1(void) const;
00171 
00175     bool setKeyAndDownloadPicture(const KURL& url);
00176 
00183     QImage generateImage(const QSize& size);
00184 
00188     bool hasAlphaBuffer() const;
00189 
00193     void setAlphaBuffer(bool enable);
00194 
00201     QImage createAlphaMask(int conversion_flags = 0) const;
00202 
00207     void clearCache(void);
00208 
00209 protected:
00214     void unlinkSharedData(void);
00219     void linkSharedData(void) const;
00224     void createSharedData(void);
00225 
00226 protected:
00231     KoPictureKey m_key;
00236     KoPictureShared* m_sharedData;
00237 };
00238 
00239 #endif /* __koPicture_h__ */
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Mar 11 11:47:42 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003