summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/tqcanvaspixmaparray.3qt
blob: 461efe40e690b4c32730ba3157fcff3fc6dde894 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
'\" t
.TH QCanvasPixmapArray 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA.  All rights reserved.  See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QCanvasPixmapArray \- Array of QCanvasPixmaps
.SH SYNOPSIS
\fC#include <ntqcanvas.h>\fR
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQCanvasPixmapArray\fR ()"
.br
.ti -1c
.BI "\fBQCanvasPixmapArray\fR ( const QString & datafilenamepattern, int fc = 0 )"
.br
.ti -1c
.BI "QCanvasPixmapArray ( QPtrList<QPixmap> list, QPtrList<QPoint> hotspots )  \fI(obsolete)\fR"
.br
.ti -1c
.BI "\fBQCanvasPixmapArray\fR ( QValueList<QPixmap> list, QPointArray hotspots = QPointArray ( ) )"
.br
.ti -1c
.BI "\fB~QCanvasPixmapArray\fR ()"
.br
.ti -1c
.BI "bool \fBreadPixmaps\fR ( const QString & filenamepattern, int fc = 0 )"
.br
.ti -1c
.BI "bool \fBreadCollisionMasks\fR ( const QString & filename )"
.br
.ti -1c
.BI "bool operator! ()  \fI(obsolete)\fR"
.br
.ti -1c
.BI "bool \fBisValid\fR () const"
.br
.ti -1c
.BI "QCanvasPixmap * \fBimage\fR ( int i ) const"
.br
.ti -1c
.BI "void \fBsetImage\fR ( int i, QCanvasPixmap * p )"
.br
.ti -1c
.BI "uint \fBcount\fR () const"
.br
.in -1c
.SH DESCRIPTION
The QCanvasPixmapArray class provides an array of QCanvasPixmaps.
.PP
This class is used by QCanvasSprite to hold an array of pixmaps. It is used to implement animated sprites, i.e. images that change over time, with each pixmap in the array holding one frame.
.PP
Depending on the constructor you use you can load multiple pixmaps into the array either from a directory (specifying a wildcard pattern for the files), or from a list of QPixmaps. You can also read in a set of pixmaps after construction using readPixmaps().
.PP
Individual pixmaps can be set with setImage() and retrieved with image(). The number of pixmaps in the array is returned by count().
.PP
QCanvasSprite uses an image's mask for collision detection. You can change this by reading in a separate set of image masks using readCollisionMasks().
.PP
See also Graphics Classes and Image Processing Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QCanvasPixmapArray::QCanvasPixmapArray ()"
Constructs an invalid array (i.e. isValid() will return FALSE). You must call readPixmaps() before being able to use this QCanvasPixmapArray.
.SH "QCanvasPixmapArray::QCanvasPixmapArray ( const QString & datafilenamepattern, int fc = 0 )"
Constructs a QCanvasPixmapArray from files.
.PP
The \fIfc\fR parameter sets the number of frames to be loaded for this image.
.PP
If \fIfc\fR is not 0, \fIdatafilenamepattern\fR should contain "%1", e.g. "foo%1.png". The actual filenames are formed by replacing the %1 with four-digit integers from 0 to (fc - 1), e.g. foo0000.png, foo0001.png, foo0002.png, etc.
.PP
If \fIfc\fR is 0, \fIdatafilenamepattern\fR is asssumed to be a filename, and the image contained in this file will be loaded as the first (and only) frame.
.PP
If \fIdatafilenamepattern\fR does not exist, is not readable, isn't an image, or some other error occurs, the array ends up empty and isValid() returns FALSE.
.SH "QCanvasPixmapArray::QCanvasPixmapArray ( QPtrList<QPixmap> list, QPtrList<QPoint> hotspots )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Use QCanvasPixmapArray::QCanvasPixmapArray( QValueList<QPixmap>, QPointArray ) instead.
.PP
Constructs a QCanvasPixmapArray from the list of QPixmaps \fIlist\fR. The \fIhotspots\fR list has to be of the same size as \fIlist\fR.
.SH "QCanvasPixmapArray::QCanvasPixmapArray ( QValueList<QPixmap> list, QPointArray hotspots = QPointArray ( ) )"
Constructs a QCanvasPixmapArray from the list of QPixmaps in the \fIlist\fR. Each pixmap will get a hotspot according to the \fIhotspots\fR array. If no hotspots are specified, each one is set to be at position (0, 0).
.PP
If an error occurs, isValid() will return FALSE.
.SH "QCanvasPixmapArray::~QCanvasPixmapArray ()"
Destroys the pixmap array and all the pixmaps it contains.
.SH "uint QCanvasPixmapArray::count () const"
Returns the number of pixmaps in the array.
.SH "QCanvasPixmap * QCanvasPixmapArray::image ( int i ) const"
Returns pixmap \fIi\fR in the array, if \fIi\fR is non-negative and less than than count(), and returns an unspecified value otherwise.
.SH "bool QCanvasPixmapArray::isValid () const"
Returns TRUE if the pixmap array is valid; otherwise returns FALSE.
.SH "bool QCanvasPixmapArray::operator! ()"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Use isValid() instead.
.PP
This returns FALSE if the array is valid, and TRUE if it is not.
.SH "bool QCanvasPixmapArray::readCollisionMasks ( const QString & filename )"
Reads new collision masks for the array.
.PP
By default, QCanvasSprite uses the image mask of a sprite to detect collisions. Use this function to set your own collision image masks.
.PP
If count() is 1 \fIfilename\fR must specify a real filename to read the mask from. If count() is greater than 1, the \fIfilename\fR must contain a "%1" that will get replaced by the number of the mask to be loaded, just like QCanvasPixmapArray::readPixmaps().
.PP
All collision masks must be 1-bit images or this function call will fail.
.PP
If the file isn't readable, contains the wrong number of images, or there is some other error, this function will return FALSE, and the array will be flagged as invalid; otherwise this function returns TRUE.
.PP
See also isValid().
.SH "bool QCanvasPixmapArray::readPixmaps ( const QString & filenamepattern, int fc = 0 )"
Reads one or more pixmaps into the pixmap array.
.PP
If \fIfc\fR is not 0, \fIfilenamepattern\fR should contain "%1", e.g." foo%1.png". The actual filenames are formed by replacing the %1 with four-digit integers from 0 to (fc - 1), e.g. foo0000.png, foo0001.png, foo0002.png, etc.
.PP
If \fIfc\fR is 0, \fIfilenamepattern\fR is asssumed to be a filename, and the image contained in this file will be loaded as the first (and only) frame.
.PP
If \fIfilenamepattern\fR does not exist, is not readable, isn't an image, or some other error occurs, this function will return FALSE, and isValid() will return FALSE; otherwise this function will return TRUE.
.PP
See also isValid().
.SH "void QCanvasPixmapArray::setImage ( int i, QCanvasPixmap * p )"
Replaces the pixmap at index \fIi\fR with pixmap \fIp\fR.
.PP
The array takes ownership of \fIp\fR and will delete \fIp\fR when the array itself is deleted.
.PP
If \fIi\fR is beyond the end of the array the array is extended to at
least i+1 elements, with elements count() to i-1 being initialized
to 0.

.SH "SEE ALSO"
.BR http://doc.trolltech.com/qcanvaspixmaparray.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech. 
.P
If you find errors in this manual page, please report them to
.BR [email protected] .
Please include the name of the manual page (tqcanvaspixmaparray.3qt) and the Qt
version (3.3.8).