KWidgetsAddons
8#include "kpixmapsequence.h"
10#include "loggingcategory.h"
18 QList<QPixmap> mFrames;
20 void loadSequence(
const QPixmap &bigPixmap,
const QSize &frameSize);
23void KPixmapSequencePrivate::loadSequence(
const QPixmap &bigPixmap,
const QSize &frameSize)
26 qCWarning(KWidgetsAddonsLog) <<
"Invalid pixmap specified.";
30 QSize size(frameSize);
31 if (!size.isValid()) {
32 size = QSize(bigPixmap.
width(), bigPixmap.
width());
34 if (bigPixmap.
width() % size.width() || bigPixmap.
height() % size.height()) {
35 qCWarning(KWidgetsAddonsLog) <<
"Invalid framesize.";
39 const int rowCount = bigPixmap.
height() / size.height();
40 const int colCount = bigPixmap.
width() / size.width();
41 mFrames.resize(rowCount * colCount);
44 for (
int row = 0; row < rowCount; ++row) {
45 for (
int col = 0; col < colCount; ++col) {
46 QPixmap pix = bigPixmap.
copy(col * size.width(), row * size.height(), size.width(), size.height());
53 : d(new KPixmapSequencePrivate)
63 : d(new KPixmapSequencePrivate)
69 : d(new KPixmapSequencePrivate)
91 return d->mFrames.isEmpty();
97 qCWarning(KWidgetsAddonsLog) <<
"No frame loaded";
100 return d->mFrames[0].size();
105 return d->mFrames.size();
111 qCWarning(KWidgetsAddonsLog) <<
"No frame loaded";
114 return d->mFrames.at(index);
~KPixmapSequence()
Destructor.
KPixmapSequence()
Create an empty sequence.
KPixmapSequence & operator=(const KPixmapSequence &other)
Create a copy of other.
int frameCount() const
The number of frames in this sequence.
QPixmap frameAt(int index) const
Retrieve the frame at index.
QPixmap copy(const QRect &rectangle) const const
bool isNull() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:52:02 by
doxygen 1.13.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.