lib Library API Documentation

KoPicture Class Reference

KoPicture is a container class for various types of images supported by KOffice. An image container class. More...

#include <koPicture.h>

List of all members.

Public Member Functions

 KoPicture (void)
 ~KoPicture (void)
 KoPicture (const KoPicture &other)
KoPictureoperator= (const KoPicture &other)
KoPictureType::Type getType (void) const
KoPictureKey getKey (void) const
void setKey (const KoPictureKey &key)
bool isNull (void) const
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)
QDragObjectdragObject (QWidget *dragSource=0L, const char *name=0L)
bool load (QIODevice *io, const QString &extension)
bool save (QIODevice *io)
bool saveAsKOffice1Dot1 (QIODevice *io)
QString getExtension (void) const
QString getMimeType (void) const
QString getExtensionAsKOffice1Dot1 (void) const
QSize getOriginalSize (void) const
void clearAndSetMode (const QString &newMode)
void clear (void)
bool loadFromFile (const QString &fileName)
bool loadXpm (QIODevice *io)
QPixmap generatePixmap (const QSize &size, bool smoothScale=false)
bool isClipartAsKOffice1Dot1 (void) const
bool setKeyAndDownloadPicture (const KURL &url)
QImage generateImage (const QSize &size)
bool hasAlphaBuffer () const
void setAlphaBuffer (bool enable)
QImage createAlphaMask (int conversion_flags=0) const
void clearCache (void)

Protected Member Functions

void unlinkSharedData (void)
void linkSharedData (void) const
void createSharedData (void)

Protected Attributes

KoPictureKey m_key
KoPictureShared * m_sharedData


Detailed Description

KoPicture is a container class for various types of images supported by KOffice. An image container class.

Definition at line 41 of file koPicture.h.


Constructor & Destructor Documentation

KoPicture::KoPicture void   ) 
 

Default constructor.

Definition at line 33 of file koPicture.cc.

KoPicture::~KoPicture void   ) 
 

Destructor.

Definition at line 37 of file koPicture.cc.

KoPicture::KoPicture const KoPicture other  ) 
 

Copy constructor.

Definition at line 42 of file koPicture.cc.


Member Function Documentation

KoPicture & KoPicture::operator= const KoPicture other  ) 
 

Assignment operator.

Definition at line 48 of file koPicture.cc.

References linkSharedData(), m_key, m_sharedData, and operator=().

Referenced by operator=().

KoPictureKey KoPicture::getKey void   )  const
 

Retrieve the key structure describing the picture in a unique way.

Definition at line 91 of file koPicture.cc.

Referenced by KoPictureCollection::downloadPicture(), and KoPictureCollection::insertPicture().

void KoPicture::setKey const KoPictureKey key  ) 
 

Set the key structure describing the picture in a unique way.

Definition at line 96 of file koPicture.cc.

References setKey().

Referenced by KoPictureCollection::findPicture(), KoPictureCollection::insertPicture(), setKey(), and setKeyAndDownloadPicture().

bool KoPicture::isNull void   )  const
 

Returns true if the picture is null.

Definition at line 101 of file koPicture.cc.

Referenced by KoPictureCollection::insertPicture(), KoPictureCollection::loadPicture(), KoPictureCollection::readFromStore(), and KoPictureCollection::saveXML().

void KoPicture::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
 

Draw the picture in a painter.

The parameter fastMode allows the picture to be re-sized and drawn quicker if possible

The parameters width, height define the desired size for the picture

The other parameters are very similar to QPainter::drawPixmap : (x, y) define the position in the painter, (sx, sy) specify the top-left point in picture that is to be drawn. The default is (0, 0). (sw, sh) specify the size of the picture that is to be drawn. The default, (-1, -1), means all the way to the bottom right of the pixmap.

Definition at line 108 of file koPicture.cc.

References draw().

Referenced by draw().

QDragObject * KoPicture::dragObject QWidget dragSource = 0L,
const char *  name = 0L
 

Create a dragobject containing this picture.

Parameters:
dragSource must be 0 when copying to the clipboard
Returns:
0L if the picture is null, or if a dragobject for it isn't implemented [yet]

Definition at line 238 of file koPicture.cc.

References dragObject().

Referenced by dragObject().

bool KoPicture::save QIODevice io  ) 
 

save file

Parameters:
io QIODevice used for saving

Definition at line 135 of file koPicture.cc.

References save().

Referenced by save().

bool KoPicture::saveAsKOffice1Dot1 QIODevice io  ) 
 

Save picture in the format supported by KOffice 1.1.

Definition at line 144 of file koPicture.cc.

References saveAsKOffice1Dot1().

Referenced by saveAsKOffice1Dot1().

QString KoPicture::getExtension void   )  const
 

Returns:
the image extension (e.g. png)

Definition at line 164 of file koPicture.cc.

QString KoPicture::getMimeType void   )  const
 

Returns:
the image MIME type

Definition at line 178 of file koPicture.cc.

QSize KoPicture::getOriginalSize void   )  const
 

Returns:
the original image size

Definition at line 200 of file koPicture.cc.

void KoPicture::clearAndSetMode const QString newMode  ) 
 

Clear and set the mode of this KoPicture.

Parameters:
newMode a file extension (like "png") giving the wanted mode

Definition at line 158 of file koPicture.cc.

References clearAndSetMode().

Referenced by clearAndSetMode().

void KoPicture::clear void   ) 
 

Reset the KoPicture (but not the key!).

Definition at line 153 of file koPicture.cc.

bool KoPicture::loadFromFile const QString fileName  ) 
 

Load the picture from a file named fileName.

Definition at line 193 of file koPicture.cc.

References loadFromFile().

Referenced by loadFromFile(), KoPictureCollection::loadPicture(), and setKeyAndDownloadPicture().

bool KoPicture::loadXpm QIODevice io  ) 
 

Load a potentially broken XPM file (for old files of KPresenter).

Definition at line 123 of file koPicture.cc.

References loadXpm().

Referenced by loadXpm().

QPixmap KoPicture::generatePixmap const QSize size,
bool  smoothScale = false
 

Deprecated:
Returns a QPixmap from an image Returns an empty QPixmap if the KoPicture is not an image.
To be replaced by KoPicture::draw

Definition at line 207 of file koPicture.cc.

References generatePixmap().

Referenced by generatePixmap().

bool KoPicture::isClipartAsKOffice1Dot1 void   )  const
 

Helper function for saving.

Returns:
true if it is a clipart in KOffice 1.1, false if not

Definition at line 214 of file koPicture.cc.

bool KoPicture::setKeyAndDownloadPicture const KURL &  url  ) 
 

Download and set the key for a possibly remote file.

Definition at line 221 of file koPicture.cc.

References loadFromFile(), setKey(), setKeyAndDownloadPicture(), and KoPictureKey::setKeyFromFile().

Referenced by KoPictureCollection::downloadPicture(), and setKeyAndDownloadPicture().

QImage KoPicture::generateImage const QSize size  ) 
 

Generate a QImage (always in slow mode).

Parameters:
size the wanted size for the QImage

Definition at line 245 of file koPicture.cc.

References generateImage().

Referenced by generateImage().

bool KoPicture::hasAlphaBuffer  )  const
 

Returns:
TRUE if the alpha channel processing has been enabled

Definition at line 252 of file koPicture.cc.

void KoPicture::setAlphaBuffer bool  enable  ) 
 

Respect the image alpha buffer.

Definition at line 259 of file koPicture.cc.

References setAlphaBuffer().

Referenced by setAlphaBuffer().

QImage KoPicture::createAlphaMask int  conversion_flags = 0  )  const
 

Creates an alpha mask for the picture (first you have to call setAlphaBuffer).

See also:
hasAlphaBuffer() setAlphaBuffer()

Definition at line 265 of file koPicture.cc.

References createAlphaMask().

Referenced by createAlphaMask().

void KoPicture::clearCache void   ) 
 

Clear any cache (to avoid using too much memory especially if the application somehow also caches the KoPicture's output).

Definition at line 272 of file koPicture.cc.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for lib Library Version 1.3.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Sep 24 18:22:32 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003