221 #include "private/qobject_p.h" 223 #define QMOVIE_INVALID_DELAY -1 242 : pixmap(pixmap), delay(delay), endMark(false)
265 int speedAdjustedDelay(
int delay)
const;
267 bool jumpToFrame(
int frameNumber);
268 int frameCount()
const;
269 bool jumpToNextFrame();
274 movieState = newState;
275 emit q_func()->stateChanged(newState);
279 void _q_loadNextFrame();
280 void _q_loadNextFrame(
bool starting);
305 : reader(0), speed(100), movieState(
QMovie::NotRunning),
306 currentFrameNumber(-1), nextFrameNumber(0), greatestFrameNumber(-1),
307 nextDelay(0), playCounter(-1),
308 cacheMode(
QMovie::CacheNone), haveReadAll(false), isFirstIteration(true)
384 if (frameNumber == 0) {
420 }
else if (frameNumber != 0) {
448 if (i == frameNumber) {
513 int processingTime = time.
elapsed();
637 d->initialDevicePos = device->
pos();
655 if (
d->reader->device())
656 d->initialDevicePos =
d->reader->device()->pos();
678 d->reader->setDevice(device);
691 return d->reader->device();
704 d->reader->setFileName(fileName);
718 return d->reader->fileName();
734 d->reader->setFormat(format);
746 return d->reader->format();
758 d->reader->setBackgroundColor(color);
770 return d->reader->backgroundColor();
781 return d->movieState;
828 return d->currentPixmap;
847 return d->currentPixmap.toImage();
926 return d->frameCount();
946 return d->currentFrameNumber;
955 return d->jumpToNextFrame();
965 return d->jumpToFrame(frameNumber);
980 return d->reader->loopCount();
997 d->nextImageTimer.stop();
1022 d->speed = percentSpeed;
1044 d->_q_loadNextFrame(
true);
1045 }
else if (
d->movieState ==
Paused) {
1066 d->nextImageTimer.stop();
1067 d->nextFrameNumber = 0;
1083 return d->reader->scaledSize();
1099 d->reader->setScaledSize(size);
1115 QMutableListIterator<QByteArray>
it(list);
1118 while (it.hasNext()) {
1120 if (!reader.supportsAnimation())
1153 return d->cacheMode;
1168 return d->cacheMode;
1173 #include "moc_qmovie.cpp" 1175 #endif // QT_NO_MOVIE The QDir class provides access to directory structures and their contents.
QColor backgroundColor() const
Returns the background color that's used when reading an image.
The QColor class provides colors based on RGB, HSV or CMYK values.
void setSingleShot(bool singleShot)
QImage toImage() const
Converts the pixmap to a QImage.
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
~QMovie()
Destructs the QMovie object.
QMovie::MovieState movieState
QMap< int, QFrameInfo > frameMap
static mach_timebase_info_data_t info
static QList< QByteArray > supportedImageFormats()
Returns the list of image formats supported by QImageReader.
#define QT_END_NAMESPACE
This macro expands to.
QMoviePrivate(QMovie *qq)
void stop()
Stops the movie.
The QMovie class is a convenience class for playing movies with QImageReader.
QSize size() const
Returns the size of the pixmap.
QMovie(QObject *parent=0)
Constructs a QMovie object, passing the parent object to QObject's constructor.
#define it(className, varName)
void setScaledSize(const QSize &size)
Sets the scaled size of the image to size.
#define QMOVIE_INVALID_DELAY
void start()
Sets this time to the current time.
QString fileName() const
Returns the name of the file that QMovie reads image data from.
bool open(OpenMode openMode)
Reimplemented Function
int speedAdjustedDelay(int delay) const
Given the original delay, this function returns the actual number of milliseconds to delay according ...
bool isNull() const
Returns true if it is a null image, otherwise returns false.
The QByteArray class provides an array of bytes.
Q_CORE_EXPORT QTextStream & reset(QTextStream &s)
virtual qint64 pos() const
For random-access devices, this function returns the position that data is written to or read from...
static QFrameInfo endMarker()
QColor backgroundColor() const
Returns the background color of the movie.
static QList< QByteArray > supportedFormats()
Returns the list of image formats supported by QMovie.
bool jumpToImage(int imageNumber)
For image formats that support animation, this function skips to the image whose sequence number is i...
The QBuffer class provides a QIODevice interface for a QByteArray.
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
void setBackgroundColor(const QColor &color)
For image formats that support it, this function sets the background color to color.
QSize scaledSize()
Returns the scaled size of frames.
void setFormat(const QByteArray &format)
Sets the format that QMovie will use when decoding image data, to format.
QPixmap currentPixmap() const
Returns the current frame as a QPixmap.
The QTime class provides clock time functions.
#define QT_BEGIN_NAMESPACE
This macro expands to.
int currentFrameNumber() const
Returns the sequence number of the current frame.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QString absolutePath() const
Returns the absolute path (a path that starts with "/" or with a drive specification), which may contain symbolic links, but never contains redundant ".", ".." or multiple separators.
void setCacheMode(CacheMode mode)
const T value(const Key &key) const
Returns the value associated with the key key.
QSize size() const
Returns the size of the rectangle.
int nextImageDelay() const
For image formats that support animation, this function returns the number of milliseconds to wait un...
void setPaused(bool paused)
If paused is true, QMovie will enter Paused state and emit stateChanged(Paused); otherwise it will en...
int loopCount() const
Returns the number of times the movie will loop before it finishes.
QFrameInfo(const QPixmap &pixmap, int delay)
The QImage class provides a hardware-independent image representation that allows direct access to th...
QFrameInfo infoForFrame(int frameNumber)
Returns the QFrameInfo for the given frameNumber.
void start()
Starts the movie.
void enterState(QMovie::MovieState newState)
QByteArray format() const
Returns the format QImageReader uses for reading images.
void setDevice(QIODevice *device)
Sets the current device to device.
The QImageReader class provides a format independent interface for reading images from files or other...
virtual bool isSequential() const
Returns true if this device is sequential; otherwise returns false.
CacheMode cacheMode() const
bool canRead() const
Returns true if an image can be read for the device (i.e., the image format is supported, and the device seems to contain valid data); otherwise returns false.
int elapsed() const
Returns the number of milliseconds that have elapsed since the last time start() or restart() was cal...
int loopCount() const
For image formats that support animation, this function returns the number of times the animation sho...
MovieState
This enum describes the different states of QMovie.
#define Q_DECLARE_PUBLIC(Class)
QImage currentImage() const
Returns the current frame as a QImage.
bool isValid() const
Returns true if the movie is valid (e.g., the image data is readable and the image format is supporte...
QIODevice * device() const
Returns the device QMovie reads image data from.
bool jumpToFrame(int frameNumber)
QIODevice * device() const
Returns the device currently assigned to QImageReader, or 0 if no device has been assigned...
iterator insert(const Key &key, const T &value)
Inserts a new item with the key key and a value of value.
void setScaledSize(const QSize &size)
Sets the scaled frame size to size.
QObject * parent() const
Returns a pointer to the parent object.
QSize scaledSize() const
Returns the scaled size of the image.
QByteArray format() const
Returns the format that QMovie uses when decoding image data.
int nextFrameDelay() const
Returns the number of milliseconds QMovie will wait before updating the next frame in the animation...
bool next()
Attempts to advance the animation to the next frame.
The QRect class defines a rectangle in the plane using integer precision.
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
void setSpeed(int percentSpeed)
MovieState state() const
Returns the current state of QMovie.
QRect rect() const
Returns the pixmap's enclosing rectangle.
The QPixmap class is an off-screen image representation that can be used as a paint device...
bool jumpToFrame(int frameNumber)
Jumps to frame number frameNumber.
bool jumpToNextFrame()
Jumps to the next frame.
The QSize class defines the size of a two-dimensional object using integer point precision.
The QTimer class provides repetitive and single-shot timers.
void setFileName(const QString &fileName)
Sets the name of the file that QMovie reads image data from, to fileName.
ImageReaderError error() const
Returns the type of error that occurred last.
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
void setBackgroundColor(const QColor &color)
Sets the background color to color.
The QIODevice class is the base interface class of all I/O devices in Qt.
void stop()
Stops the timer.
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
int frameCount() const
Returns the number of frames in the movie.
virtual bool seek(qint64 pos)
For random-access devices, this function sets the current position to pos, returning true on success...
static QString fileName(const QString &fileUrl)
QImage read()
Reads an image from the device.
void clear()
Removes all items from the map.
QRect frameRect() const
Returns the rect of the last frame.
int imageCount() const
For image formats that support animation, this function returns the total number of images in the ani...
CacheMode
This enum describes the different cache modes of QMovie.
QString fileName() const
If the currently assigned device is a QFile, or if setFileName() has been called, this function retur...
QMovie::CacheMode cacheMode