Qt Toolkit - QCanvasPixmapArray Class

| Classes - Annotated - Tree - Functions - Home - Structure

# QCanvasPixmapArray Class Reference
[ canvas module ]

An array of QCanvasPixmap to have multiple frames for animation. More...

`#include <qcanvas.h>`

List of all member functions.

## Public Members

- QCanvasPixmapArray ()
- QCanvasPixmapArray ( const QString & datafilenamepattern, int framecount=0 )
- QCanvasPixmapArray ( QList<QPixmap>, QList<QPoint> hotspots )
- ~QCanvasPixmapArray ()
- bool readPixmaps ( const QString & datafilenamepattern, int framecount=0 )
- bool readCollisionMasks ( const QString & filenamepattern )
- int operator! ()
- QCanvasPixmap* image ( int i ) const
- void setImage ( int i, QCanvasPixmap * p )
- uint count () const

## Detailed Description

An array of QCanvasPixmap to have multiple frames for animation.

This allows sprite objects to have multiple frames for animation.

QCanvasPixmaps for sprite objects are collected into QCanvasPixmapArrays, which are the set of images a sprite will use, indexed by the sprite's frame. This allows sprites to simply have animated forms.

## Member Function Documentation

### QCanvasPixmapArray::QCanvasPixmapArray ()

Constructs a null array. You should call readPixmaps() before using it further.

### QCanvasPixmapArray::QCanvasPixmapArray ( QList<QPixmap> list, QList<QPoint> hotspots )

Constructs a QCanvasPixmapArray from QPixmaps.

### QCanvasPixmapArray::QCanvasPixmapArray ( const QString & datafilenamepattern, int fc=0 )

Constructs a QCanvasPixmapArray from files.

The fc parameter sets the number of frames to be loaded for this image. If fc is not 0, the filenames should contain a "%1", strings such as "foo%1.png". The actual filenames are formed by replacing the %1 with each integer from 0 to fc-1, with leading zeroes sufficient for 4 digits. eg. foo0000.png, foo0001.png, foo0002.png, etc.

### QCanvasPixmapArray::~QCanvasPixmapArray ()

Destructs the pixmap array.

### uint QCanvasPixmapArray::count () const

Returns the length of the array.

### QCanvasPixmap* QCanvasPixmapArray::image ( int i ) const

Returns the i-th pixmap in the array.

### int QCanvasPixmapArray::operator! ()

Constructor failure check.

### bool QCanvasPixmapArray::readCollisionMasks ( const QString & fname )

When testing sprite collision detection the default is to use the image mask of the sprite. By using readCollisionMasks(), an alternate mask can be used. The images must be 1-bit deep.

### bool QCanvasPixmapArray::readPixmaps ( const QString & datafilenamepattern, int fc=0 )

Read new pixmaps into the array.

### void QCanvasPixmapArray::setImage ( int i, QCanvasPixmap * p )

Replaces the i-th pixmap by p. Note that p becomes owned by the array - it will be deleted later.

Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):

This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.