lib
KoPicture Class Reference
#include <KoPicture.h>
Detailed Description
KoPicture is a container class for various types of pictures supported by KOffice.A picture container class.
Definition at line 43 of file KoPicture.h.
Public Member Functions | |
KoPicture (void) | |
~KoPicture (void) | |
KoPicture (const KoPicture &other) | |
KoPicture & | operator= (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) |
QDragObject * | dragObject (QWidget *dragSource=0L, const char *name=0L) |
bool | load (QIODevice *io, const QString &extension) |
bool | save (QIODevice *io) const |
bool | saveAsBase64 (KoXmlWriter &writer) const |
QString | getExtension (void) const |
QString | getMimeType (void) const |
QSize | getOriginalSize (void) const |
void | clearAndSetMode (const QString &newMode) |
void | clear (void) |
bool | loadFromFile (const QString &fileName) |
bool | loadFromBase64 (const QCString &str) |
bool | loadXpm (QIODevice *io) |
QPixmap | generatePixmap (const QSize &size, bool smoothScale=false) |
bool | setKeyAndDownloadPicture (const KURL &url, QWidget *window) |
QImage | generateImage (const QSize &size) |
bool | hasAlphaBuffer () const |
void | setAlphaBuffer (bool enable) |
QImage | createAlphaMask (int conversion_flags=0) const |
void | clearCache (void) |
QString | uniquePictureId () const |
void | assignPictureId (uint _id) |
Protected Member Functions | |
void | unlinkSharedData (void) |
void | linkSharedData (void) const |
void | createSharedData (void) |
QString | uniqueName () const |
Protected Attributes | |
KoPictureKey | m_key |
KoPictureShared * | m_sharedData |
QString | m_uniqueName |
Static Protected Attributes | |
static uint | uniqueValue = 0 |
Constructor & Destructor Documentation
KoPicture::KoPicture | ( | void | ) |
KoPicture::~KoPicture | ( | void | ) |
KoPicture::KoPicture | ( | const KoPicture & | other | ) |
Member Function Documentation
void KoPicture::clear | ( | void | ) |
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 180 of file KoPicture.cpp.
void KoPicture::clearCache | ( | void | ) |
Clear any cache.
This is used to avoid using too much memory especially if the application somehow also caches the KoPicture's output
Definition at line 286 of file KoPicture.cpp.
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 279 of file KoPicture.cpp.
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 name name for the QDragObject
- Returns:
- 0L if the picture is null, or if a dragobject for it isn't implemented [yet]
Definition at line 252 of file KoPicture.cpp.
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 132 of file KoPicture.cpp.
QImage KoPicture::generateImage | ( | const QSize & | size | ) |
Generate a QImage (always in slow mode).
- Parameters:
-
size the wanted size for the QImage
Definition at line 259 of file KoPicture.cpp.
QPixmap KoPicture::generatePixmap | ( | const QSize & | size, | |
bool | smoothScale = false | |||
) |
- Deprecated:
- To be replaced by KoPicture::draw
Definition at line 228 of file KoPicture.cpp.
QString KoPicture::getExtension | ( | void | ) | const |
KoPictureKey KoPicture::getKey | ( | void | ) | const |
Retrieve the key structure describing the picture in a unique way.
Definition at line 114 of file KoPicture.cpp.
QString KoPicture::getMimeType | ( | void | ) | const |
QSize KoPicture::getOriginalSize | ( | void | ) | const |
bool KoPicture::hasAlphaBuffer | ( | ) | const |
- Returns:
- TRUE if the alpha channel processing has been enabled
Definition at line 266 of file KoPicture.cpp.
bool KoPicture::isNull | ( | void | ) | const |
bool KoPicture::loadFromBase64 | ( | const QCString & | str | ) |
bool KoPicture::loadFromFile | ( | const QString & | fileName | ) |
bool KoPicture::loadXpm | ( | QIODevice * | io | ) |
Load a potentially broken XPM file (for old files of KPresenter).
Definition at line 147 of file KoPicture.cpp.
bool KoPicture::save | ( | QIODevice * | io | ) | const |
Save picture into a QIODevice.
- Parameters:
-
io QIODevice used for saving
Definition at line 159 of file KoPicture.cpp.
bool KoPicture::saveAsBase64 | ( | KoXmlWriter & | writer | ) | const |
OASIS FlatXML support: Save picture as base64-encoded data into an XML writer.
The caller will usually do something like
writer.startElement( "office:binary-data" );
m_picture.saveAsBase64( writer );
writer.endElement();
Definition at line 168 of file KoPicture.cpp.
void KoPicture::setAlphaBuffer | ( | bool | enable | ) |
void KoPicture::setKey | ( | const KoPictureKey & | key | ) |
Set the key structure describing the picture in a unique way.
Definition at line 119 of file KoPicture.cpp.
bool KoPicture::setKeyAndDownloadPicture | ( | const KURL & | url, | |
QWidget * | window | |||
) |
Download and set the key for a possibly remote file.
- Parameters:
-
url the url to download from window the parent widget for the download. You can pass NULL (0) if you absolutely cannot find a parent widget to use.
Definition at line 235 of file KoPicture.cpp.
The documentation for this class was generated from the following files: