libs/flake

KoImageData Class Reference

This class is meant to represent the image data so it can be shared between image shapes. More...

#include <KoImageData.h>

Inheritance diagram for KoImageData:

List of all members.

Public Types

enum  ErrorCode { Success, OpenFailed, StorageFailed, LoadFailed }

Public Member Functions

 KoImageData (const KoImageData &imageData)
 KoImageData ()
virtual ~KoImageData ()
ErrorCode errorCode () const
bool hasCachedImage () const
bool hasCachedPixmap () const
QImage image () const
QSizeF imageSize ()
bool isValid () const
qint64 key () const
bool operator!= (const KoImageData &other) const
KoImageDataoperator= (const KoImageData &other)
bool operator== (const KoImageData &other) const
QPixmap pixmap (const QSize &targetSize=QSize())
KoImageDataPrivate * priv ()
bool saveData (QIODevice &device)
void setExternalImage (const QUrl &location, KoImageCollection *collection=0)
void setImage (const QString &location, KoStore *store, KoImageCollection *collection=0)
void setImage (const QByteArray &imageData, KoImageCollection *collection=0)
void setImage (const QImage &image, KoImageCollection *collection=0)
QString suffix () const

Protected Member Functions

 KoImageData (KoImageDataPrivate *priv)

Detailed Description

This class is meant to represent the image data so it can be shared between image shapes.

In KOffice there is a picture shape and a krita shape which both can both show an image. To allow smooth transition of image data between shapes, as well as allowing lower-resolution data to be shown this class will actually be the backing store of the image data and it can create a pre-rendered QPixmap without deminishing the backing-store data. This class inherits from KoShapeUserData which means you can set it on any KoShape using KoShape::setUserData() and get it using KoShape::userData(). The pictureshape plugin uses this class to show its image data. Such plugins are suggested to not make a copy of the pixmap data, but use the fact that this image data caches one for every request to pixmap()

Definition at line 52 of file KoImageData.h.


Member Enumeration Documentation

Various error codes representing what has gone wrong.

Enumerator:
Success 
OpenFailed 
StorageFailed 

This is set if the image data has to be stored on disk in a temporary file, but we failed to do so.

LoadFailed 

Definition at line 57 of file KoImageData.h.


Constructor & Destructor Documentation

KoImageData::KoImageData (  ) 

default constructor, creates an invalid imageData object

Definition at line 43 of file KoImageData.cpp.

KoImageData::KoImageData ( const KoImageData imageData  ) 

copy constructor

Parameters:
imageData the other one.

Definition at line 48 of file KoImageData.cpp.

KoImageData::~KoImageData (  )  [virtual]

destructor

Definition at line 62 of file KoImageData.cpp.

KoImageData::KoImageData ( KoImageDataPrivate *  priv  )  [protected]

For internal use only.

Definition at line 56 of file KoImageData.cpp.


Member Function Documentation

KoImageData::ErrorCode KoImageData::errorCode (  )  const

Definition at line 350 of file KoImageData.cpp.

bool KoImageData::hasCachedImage (  )  const

returns true only if image() would return immediately with a cached image

Definition at line 153 of file KoImageData.cpp.

bool KoImageData::hasCachedPixmap (  )  const

returns true only if pixmap() would return immediately with a cached pixmap

Definition at line 109 of file KoImageData.cpp.

QImage KoImageData::image (  )  const

Return the internal store of the image.

See also:
isValid(), hasCachedImage()

Definition at line 134 of file KoImageData.cpp.

QSizeF KoImageData::imageSize (  ) 

The size of the image in points.

Definition at line 114 of file KoImageData.cpp.

bool KoImageData::isValid (  )  const

returns if this is a valid imageData with actual image data present on it.

Definition at line 319 of file KoImageData.cpp.

qint64 KoImageData::key (  )  const

Get a unique key of the image data.

Definition at line 340 of file KoImageData.cpp.

bool KoImageData::operator!= ( const KoImageData other  )  const [inline]

Definition at line 113 of file KoImageData.h.

KoImageData & KoImageData::operator= ( const KoImageData other  ) 

Definition at line 330 of file KoImageData.cpp.

bool KoImageData::operator== ( const KoImageData other  )  const

Definition at line 325 of file KoImageData.cpp.

QPixmap KoImageData::pixmap ( const QSize targetSize = QSize()  ) 

Renders a pixmap the first time you request it is called and returns it.

Returns:
the cached pixmap
See also:
isValid(), hasCachedPixmap()

Definition at line 68 of file KoImageData.cpp.

KoImageDataPrivate* KoImageData::priv (  )  [inline]

For internal use only.

Definition at line 129 of file KoImageData.h.

bool KoImageData::saveData ( QIODevice device  ) 

Save the image data to the param device.

The full file is saved.

Parameters:
device the device that is used to get the data from.
Returns:
returns true if load was successful.

Definition at line 355 of file KoImageData.cpp.

void KoImageData::setExternalImage ( const QUrl location,
KoImageCollection collection = 0 
)

Definition at line 203 of file KoImageData.cpp.

void KoImageData::setImage ( const QString location,
KoStore *  store,
KoImageCollection collection = 0 
)

Definition at line 227 of file KoImageData.cpp.

void KoImageData::setImage ( const QByteArray imageData,
KoImageCollection collection = 0 
)

Definition at line 277 of file KoImageData.cpp.

void KoImageData::setImage ( const QImage image,
KoImageCollection collection = 0 
)

Definition at line 158 of file KoImageData.cpp.

QString KoImageData::suffix (  )  const

Definition at line 345 of file KoImageData.cpp.


The documentation for this class was generated from the following files: