KVIrc  4.9.2
DeveloperAPIs
Signals | Public Member Functions | Protected Attributes | List of all members
KviAnimatedPixmap Class Reference

#include <KviAnimatedPixmap.h>

+ Inheritance diagram for KviAnimatedPixmap:

Signals

void frameChanged ()
 

Public Member Functions

uint activeFrameNumber ()
 
uint framesCount ()
 
bool isStarted ()
 
bool isValid ()
 
 KviAnimatedPixmap (QString fileName, int iWidth=0, int iHeight=0)
 
 KviAnimatedPixmap (const KviAnimatedPixmap &source)
 
void nextFrame (bool bEmitSignalAndScheduleNext)
 
QPixmap * pixmap ()
 
void resize (QSize newSize, Qt::AspectRatioMode ratioMode)
 
const QSize & size ()
 
void start ()
 
void stop ()
 
virtual ~KviAnimatedPixmap ()
 
- Public Member Functions inherited from KviAnimatedPixmapInterface
virtual ~KviAnimatedPixmapInterface ()
 

Protected Attributes

int m_iStarted
 
KviAnimatedPixmapCache::Datam_pFrameData
 
QString m_szFileName
 
uint m_uCurrentFrameNumber
 

Detailed Description

This class should not be here, because we already have QMovie with the same functionality.

But QMovie is really stupid, bacause: 1) It does not support infinitive animation. It relies on image metadata to determine loop count. So most of pics will be played only once.

2) It duplicates QPixmap while we calls currentFrame(), that's a very big overload for us.

3) If we try to scale QMovie by using built-in scale mechanism, it will manually scale each frame each time, we will call currentFrame(). So if we plan to play movie 10,100,1000 times, it will scale image 10,100,1000 times too:(

4) KviAnimatedPixmap uses internal cache mechanism with KviAnimatedPixmapCache class. It's managed inside KviAnimatedPixmap and KviAnimatedPixmapCache. No other actions needed to perform caching.

So... Here is my workaround. It's working in this way: You should create new pixmap with constructor KviAnimatedPixmap(QString fileName). It will automagically look at cache and use it, if possible.

KviAnimatedPixmap stores animation as a set of QPixmap's, and delays. when started (see start()) it emits frameChanged() events at the frame change.

You should use pixmap() methd to access the current frame.

This class owns all pixmaps. Do not store links to them.

Constructor & Destructor Documentation

KviAnimatedPixmap::KviAnimatedPixmap ( QString  fileName,
int  iWidth = 0,
int  iHeight = 0 
)
KviAnimatedPixmap::~KviAnimatedPixmap ( )
virtual
KviAnimatedPixmap::KviAnimatedPixmap ( const KviAnimatedPixmap source)

Member Function Documentation

uint KviAnimatedPixmap::activeFrameNumber ( )
inline
void KviAnimatedPixmap::frameChanged ( )
signal

Referenced by nextFrame().

uint KviAnimatedPixmap::framesCount ( )
inline
bool KviAnimatedPixmap::isStarted ( )
inline
bool KviAnimatedPixmap::isValid ( )
inline
void KviAnimatedPixmap::nextFrame ( bool  bEmitSignalAndScheduleNext)
virtual
QPixmap* KviAnimatedPixmap::pixmap ( )
inline
void KviAnimatedPixmap::resize ( QSize  newSize,
Qt::AspectRatioMode  ratioMode 
)
const QSize& KviAnimatedPixmap::size ( )
inline
void KviAnimatedPixmap::start ( )
void KviAnimatedPixmap::stop ( )

Member Data Documentation

int KviAnimatedPixmap::m_iStarted
protected

Referenced by nextFrame(), start(), and stop().

KviAnimatedPixmapCache::Data* KviAnimatedPixmap::m_pFrameData
protected
QString KviAnimatedPixmap::m_szFileName
protected
uint KviAnimatedPixmap::m_uCurrentFrameNumber
protected

Referenced by nextFrame(), and start().


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