lib

#include <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 (TQPainter &painter, int x, int y, int width, int height, int sx=0, int sy=0, int sw=-1, int sh=-1, bool fastMode=false)
TQDragObject * dragObject (TQWidget *dragSource=0L, const char *name=0L)
bool load (TQIODevice *io, const TQString &extension)
bool save (TQIODevice *io) const
bool saveAsBase64 (KoXmlWriter &writer) const
TQString getExtension (void) const
TQString getMimeType (void) const
TQSize getOriginalSize (void) const
void clearAndSetMode (const TQString &newMode)
void clear (void)
bool loadFromFile (const TQString &fileName)
bool loadFromBase64 (const TQCString &str)
bool loadXpm (TQIODevice *io)
TQPixmap generatePixmap (const TQSize &size, bool smoothScale=false)
bool setKeyAndDownloadPicture (const KURL &url, TQWidget *window)
TQImage generateImage (const TQSize &size)
bool hasAlphaBuffer () const
void setAlphaBuffer (bool enable)
TQImage createAlphaMask (int conversion_flags=0) const
void clearCache (void)
TQString uniquePictureId () const
void assignPictureId (uint _id)

Protected Member Functions

void unlinkSharedData (void)
void linkSharedData (void) const
void createSharedData (void)
TQString uniqueName () const

Protected Attributes

KoPictureKey m_key
KoPictureShared * m_sharedData
TQString m_uniqueName

Static Protected Attributes

static uint uniqueValue = 0

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.

Constructor & Destructor Documentation

◆ KoPicture() [1/2]

KoPicture::KoPicture ( void )

Default constructor.

Definition at line 36 of file KoPicture.cpp.

◆ ~KoPicture()

KoPicture::~KoPicture ( void )

Destructor.

Definition at line 41 of file KoPicture.cpp.

◆ KoPicture() [2/2]

KoPicture::KoPicture ( const KoPicture & other)

Copy constructor.

Definition at line 51 of file KoPicture.cpp.

Member Function Documentation

◆ assignPictureId()

void KoPicture::assignPictureId ( uint _id)

Definition at line 57 of file KoPicture.cpp.

◆ clear()

void KoPicture::clear ( void )

Reset the KoPicture (but not the key!).

Definition at line 175 of file KoPicture.cpp.

◆ clearAndSetMode()

void KoPicture::clearAndSetMode ( const TQString & newMode)

Clear and set the mode of this KoPicture.

Parameters
newModea file extension (like "png") giving the wanted mode

Definition at line 180 of file KoPicture.cpp.

◆ clearCache()

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.

◆ createAlphaMask()

TQImage 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.

◆ createSharedData()

void KoPicture::createSharedData ( void )
protected

Definition at line 98 of file KoPicture.cpp.

◆ dragObject()

TQDragObject * KoPicture::dragObject ( TQWidget * dragSource = 0L,
const char * name = 0L )

Create a dragobject containing this picture.

Parameters
dragSourcemust be 0 when copying to the clipboard
namename for the TQDragObject
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.

◆ draw()

void KoPicture::draw ( TQPainter & 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 TQPainter::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.

◆ generateImage()

TQImage KoPicture::generateImage ( const TQSize & size)

Generate a TQImage (always in slow mode).

Parameters
sizethe wanted size for the TQImage

Definition at line 259 of file KoPicture.cpp.

◆ generatePixmap()

TQPixmap KoPicture::generatePixmap ( const TQSize & size,
bool smoothScale = false )
Deprecated
To be replaced by KoPicture::draw

Returns a TQPixmap from an image Returns an empty TQPixmap if the KoPicture is not an image.

Definition at line 228 of file KoPicture.cpp.

◆ getExtension()

TQString KoPicture::getExtension ( void ) const
Returns
the image extension (e.g. png)

Definition at line 186 of file KoPicture.cpp.

◆ getKey()

KoPictureKey KoPicture::getKey ( void ) const

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

Definition at line 114 of file KoPicture.cpp.

◆ getMimeType()

TQString KoPicture::getMimeType ( void ) const
Returns
the image MIME type

Definition at line 193 of file KoPicture.cpp.

◆ getOriginalSize()

TQSize KoPicture::getOriginalSize ( void ) const
Returns
the original image size

Definition at line 221 of file KoPicture.cpp.

◆ getType()

KoPictureType::Type KoPicture::getType ( void ) const

Definition at line 107 of file KoPicture.cpp.

◆ hasAlphaBuffer()

bool KoPicture::hasAlphaBuffer ( ) const
Returns
true if the alpha channel processing has been enabled

Definition at line 266 of file KoPicture.cpp.

◆ isNull()

bool KoPicture::isNull ( void ) const

Returns true if the picture is null.

Definition at line 125 of file KoPicture.cpp.

◆ linkSharedData()

void KoPicture::linkSharedData ( void ) const
protected

Definition at line 92 of file KoPicture.cpp.

◆ load()

bool KoPicture::load ( TQIODevice * io,
const TQString & extension )

Definition at line 200 of file KoPicture.cpp.

◆ loadFromBase64()

bool KoPicture::loadFromBase64 ( const TQCString & str)

Load the picture from base64-encoded data.

Definition at line 215 of file KoPicture.cpp.

◆ loadFromFile()

bool KoPicture::loadFromFile ( const TQString & fileName)

Load the picture from a file named fileName.

Definition at line 208 of file KoPicture.cpp.

◆ loadXpm()

bool KoPicture::loadXpm ( TQIODevice * io)

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

Definition at line 147 of file KoPicture.cpp.

◆ operator=()

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

Assignment operator.

Definition at line 71 of file KoPicture.cpp.

◆ save()

bool KoPicture::save ( TQIODevice * io) const

Save picture into a TQIODevice.

Parameters
ioTQIODevice used for saving

Definition at line 159 of file KoPicture.cpp.

◆ saveAsBase64()

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.

◆ setAlphaBuffer()

void KoPicture::setAlphaBuffer ( bool enable)

Respect the image alpha buffer.

Definition at line 273 of file KoPicture.cpp.

◆ setKey()

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.

◆ setKeyAndDownloadPicture()

bool KoPicture::setKeyAndDownloadPicture ( const KURL & url,
TQWidget * window )

Download and set the key for a possibly remote file.

Parameters
urlthe url to download from
windowthe 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.

◆ uniqueName()

TQString KoPicture::uniqueName ( ) const
protected

Definition at line 46 of file KoPicture.cpp.

◆ uniquePictureId()

TQString KoPicture::uniquePictureId ( ) const

Definition at line 63 of file KoPicture.cpp.

◆ unlinkSharedData()

void KoPicture::unlinkSharedData ( void )
protected

Definition at line 84 of file KoPicture.cpp.

Member Data Documentation

◆ m_key

KoPictureKey KoPicture::m_key
protected

Definition at line 248 of file KoPicture.h.

◆ m_sharedData

KoPictureShared* KoPicture::m_sharedData
protected

Definition at line 253 of file KoPicture.h.

◆ m_uniqueName

TQString KoPicture::m_uniqueName
protected

Definition at line 256 of file KoPicture.h.

◆ uniqueValue

uint KoPicture::uniqueValue = 0
staticprotected

Definition at line 254 of file KoPicture.h.


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