1QCanvasPixmapArray(3qt) QCanvasPixmapArray(3qt)
2
3
4
6 QCanvasPixmapArray - Array of QCanvasPixmaps
7
9 #include <qcanvas.h>
10
11 Public Members
12 QCanvasPixmapArray ()
13 QCanvasPixmapArray ( const QString & datafilenamepattern, int fc = 0 )
14 QCanvasPixmapArray ( QPtrList<QPixmap> list, QPtrList<QPoint> hotspots
15 ) (obsolete)
16 QCanvasPixmapArray ( QValueList<QPixmap> list, QPointArray hotspots =
17 QPointArray ( ) )
18 ~QCanvasPixmapArray ()
19 bool readPixmaps ( const QString & filenamepattern, int fc = 0 )
20 bool readCollisionMasks ( const QString & filename )
21 bool operator! () (obsolete)
22 bool isValid () const
23 QCanvasPixmap * image ( int i ) const
24 void setImage ( int i, QCanvasPixmap * p )
25 uint count () const
26
28 The QCanvasPixmapArray class provides an array of QCanvasPixmaps.
29
30 This class is used by QCanvasSprite to hold an array of pixmaps. It is
31 used to implement animated sprites, i.e. images that change over time,
32 with each pixmap in the array holding one frame.
33
34 Depending on the constructor you use you can load multiple pixmaps into
35 the array either from a directory (specifying a wildcard pattern for
36 the files), or from a list of QPixmaps. You can also read in a set of
37 pixmaps after construction using readPixmaps().
38
39 Individual pixmaps can be set with setImage() and retrieved with
40 image(). The number of pixmaps in the array is returned by count().
41
42 QCanvasSprite uses an image's mask for collision detection. You can
43 change this by reading in a separate set of image masks using
44 readCollisionMasks().
45
46 See also Graphics Classes and Image Processing Classes.
47
50 Constructs an invalid array (i.e. isValid() will return FALSE). You
51 must call readPixmaps() before being able to use this
52 QCanvasPixmapArray.
53
55 int fc = 0 )
56 Constructs a QCanvasPixmapArray from files.
57
58 The fc parameter sets the number of frames to be loaded for this image.
59
60 If fc is not 0, datafilenamepattern should contain "%1", e.g.
61 "foo%1.png". The actual filenames are formed by replacing the %1 with
62 four-digit integers from 0 to (fc - 1), e.g. foo0000.png, foo0001.png,
63 foo0002.png, etc.
64
65 If fc is 0, datafilenamepattern is asssumed to be a filename, and the
66 image contained in this file will be loaded as the first (and only)
67 frame.
68
69 If datafilenamepattern does not exist, is not readable, isn't an image,
70 or some other error occurs, the array ends up empty and isValid()
71 returns FALSE.
72
74 QPtrList<QPoint> hotspots )
75 This function is obsolete. It is provided to keep old source working.
76 We strongly advise against using it in new code.
77
78 Use QCanvasPixmapArray::QCanvasPixmapArray( QValueList<QPixmap>,
79 QPointArray ) instead.
80
81 Constructs a QCanvasPixmapArray from the list of QPixmaps list. The
82 hotspots list has to be of the same size as list.
83
85 hotspots = QPointArray ( ) )
86 Constructs a QCanvasPixmapArray from the list of QPixmaps in the list.
87 Each pixmap will get a hotspot according to the hotspots array. If no
88 hotspots are specified, each one is set to be at position (0, 0).
89
90 If an error occurs, isValid() will return FALSE.
91
93 Destroys the pixmap array and all the pixmaps it contains.
94
96 Returns the number of pixmaps in the array.
97
99 Returns pixmap i in the array, if i is non-negative and less than than
100 count(), and returns an unspecified value otherwise.
101
103 Returns TRUE if the pixmap array is valid; otherwise returns FALSE.
104
106 This function is obsolete. It is provided to keep old source working.
107 We strongly advise against using it in new code.
108
109 Use isValid() instead.
110
111 This returns FALSE if the array is valid, and TRUE if it is not.
112
114 Reads new collision masks for the array.
115
116 By default, QCanvasSprite uses the image mask of a sprite to detect
117 collisions. Use this function to set your own collision image masks.
118
119 If count() is 1 filename must specify a real filename to read the mask
120 from. If count() is greater than 1, the filename must contain a "%1"
121 that will get replaced by the number of the mask to be loaded, just
122 like QCanvasPixmapArray::readPixmaps().
123
124 All collision masks must be 1-bit images or this function call will
125 fail.
126
127 If the file isn't readable, contains the wrong number of images, or
128 there is some other error, this function will return FALSE, and the
129 array will be flagged as invalid; otherwise this function returns TRUE.
130
131 See also isValid().
132
134 = 0 )
135 Reads one or more pixmaps into the pixmap array.
136
137 If fc is not 0, filenamepattern should contain "%1", e.g." foo%1.png".
138 The actual filenames are formed by replacing the %1 with four-digit
139 integers from 0 to (fc - 1), e.g. foo0000.png, foo0001.png,
140 foo0002.png, etc.
141
142 If fc is 0, filenamepattern is asssumed to be a filename, and the image
143 contained in this file will be loaded as the first (and only) frame.
144
145 If filenamepattern does not exist, is not readable, isn't an image, or
146 some other error occurs, this function will return FALSE, and isValid()
147 will return FALSE; otherwise this function will return TRUE.
148
149 See also isValid().
150
152 Replaces the pixmap at index i with pixmap p.
153
154 The array takes ownership of p and will delete p when the array itself
155 is deleted.
156
157 If i is beyond the end of the array the array is extended to at least
158 i+1 elements, with elements count() to i-1 being initialized to 0.
159
160
162 http://doc.trolltech.com/qcanvaspixmaparray.html
163 http://www.trolltech.com/faq/tech.html
164
166 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
167 license file included in the distribution for a complete license
168 statement.
169
171 Generated automatically from the source code.
172
174 If you find a bug in Qt, please report it as described in
175 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
176 help you. Thank you.
177
178 The definitive Qt documentation is provided in HTML format; it is
179 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
180 web browser. This man page is provided as a convenience for those users
181 who prefer man pages, although this format is not officially supported
182 by Trolltech.
183
184 If you find errors in this manual page, please report them to qt-
185 bugs@trolltech.com. Please include the name of the manual page
186 (qcanvaspixmaparray.3qt) and the Qt version (3.3.8).
187
188
189
190Trolltech AS 2 February 2007 QCanvasPixmapArray(3qt)