1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/canvas/qcanvas.cpp:2930 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QCanvasPixmapArray Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QCanvasPixmapArray Class Reference<br><small>[<a href="canvas.html">canvas module</a>]</small></h1>
|
---|
33 |
|
---|
34 | <p>The QCanvasPixmapArray class provides an array of QCanvasPixmaps.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p><tt>#include <<a href="qcanvas-h.html">qcanvas.h</a>></tt>
|
---|
37 | <p><a href="qcanvaspixmaparray-members.html">List of all member functions.</a>
|
---|
38 | <h2>Public Members</h2>
|
---|
39 | <ul>
|
---|
40 | <li class=fn><a href="#QCanvasPixmapArray"><b>QCanvasPixmapArray</b></a> ()</li>
|
---|
41 | <li class=fn><a href="#QCanvasPixmapArray-2"><b>QCanvasPixmapArray</b></a> ( const QString & datafilenamepattern, int fc = 0 )</li>
|
---|
42 | <li class=fn>QCanvasPixmapArray ( QPtrList<QPixmap> list, QPtrList<QPoint> hotspots ) <em>(obsolete)</em></li>
|
---|
43 | <li class=fn><a href="#QCanvasPixmapArray-4"><b>QCanvasPixmapArray</b></a> ( QValueList<QPixmap> list, QPointArray hotspots = QPointArray ( ) )</li>
|
---|
44 | <li class=fn><a href="#~QCanvasPixmapArray"><b>~QCanvasPixmapArray</b></a> ()</li>
|
---|
45 | <li class=fn>bool <a href="#readPixmaps"><b>readPixmaps</b></a> ( const QString & filenamepattern, int fc = 0 )</li>
|
---|
46 | <li class=fn>bool <a href="#readCollisionMasks"><b>readCollisionMasks</b></a> ( const QString & filename )</li>
|
---|
47 | <li class=fn>bool operator! () <em>(obsolete)</em></li>
|
---|
48 | <li class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</li>
|
---|
49 | <li class=fn>QCanvasPixmap * <a href="#image"><b>image</b></a> ( int i ) const</li>
|
---|
50 | <li class=fn>void <a href="#setImage"><b>setImage</b></a> ( int i, QCanvasPixmap * p )</li>
|
---|
51 | <li class=fn>uint <a href="#count"><b>count</b></a> () const</li>
|
---|
52 | </ul>
|
---|
53 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
54 |
|
---|
55 |
|
---|
56 | The QCanvasPixmapArray class provides an array of QCanvasPixmaps.
|
---|
57 |
|
---|
58 | <p>
|
---|
59 |
|
---|
60 |
|
---|
61 | <p> This class is used by <a href="qcanvassprite.html">QCanvasSprite</a> to hold an array of pixmaps.
|
---|
62 | It is used to implement animated sprites, i.e. images that change
|
---|
63 | over time, with each pixmap in the array holding one frame.
|
---|
64 | <p> Depending on the constructor you use you can load multiple pixmaps
|
---|
65 | into the array either from a directory (specifying a wildcard
|
---|
66 | pattern for the files), or from a list of QPixmaps. You can also
|
---|
67 | read in a set of pixmaps after construction using <a href="#readPixmaps">readPixmaps</a>().
|
---|
68 | <p> Individual pixmaps can be set with <a href="#setImage">setImage</a>() and retrieved with
|
---|
69 | <a href="#image">image</a>(). The number of pixmaps in the array is returned by
|
---|
70 | <a href="#count">count</a>().
|
---|
71 | <p> QCanvasSprite uses an image's mask for collision detection. You
|
---|
72 | can change this by reading in a separate set of image masks using
|
---|
73 | <a href="#readCollisionMasks">readCollisionMasks</a>().
|
---|
74 | <p> <p>See also <a href="graphics.html">Graphics Classes</a> and <a href="images.html">Image Processing Classes</a>.
|
---|
75 |
|
---|
76 | <hr><h2>Member Function Documentation</h2>
|
---|
77 | <h3 class=fn><a name="QCanvasPixmapArray"></a>QCanvasPixmapArray::QCanvasPixmapArray ()
|
---|
78 | </h3>
|
---|
79 | Constructs an invalid array (i.e. <a href="#isValid">isValid</a>() will return FALSE).
|
---|
80 | You must call <a href="#readPixmaps">readPixmaps</a>() before being able to use this
|
---|
81 | QCanvasPixmapArray.
|
---|
82 |
|
---|
83 | <h3 class=fn><a name="QCanvasPixmapArray-2"></a>QCanvasPixmapArray::QCanvasPixmapArray ( const <a href="qstring.html">QString</a> & datafilenamepattern, int fc = 0 )
|
---|
84 | </h3>
|
---|
85 | Constructs a QCanvasPixmapArray from files.
|
---|
86 | <p> The <em>fc</em> parameter sets the number of frames to be loaded for
|
---|
87 | this image.
|
---|
88 | <p> If <em>fc</em> is not 0, <em>datafilenamepattern</em> should contain "%1",
|
---|
89 | e.g. "foo%1.png". The actual filenames are formed by replacing the
|
---|
90 | %1 with four-digit integers from 0 to (fc - 1), e.g. foo0000.png,
|
---|
91 | foo0001.png, foo0002.png, etc.
|
---|
92 | <p> If <em>fc</em> is 0, <em>datafilenamepattern</em> is asssumed to be a
|
---|
93 | filename, and the image contained in this file will be loaded as
|
---|
94 | the first (and only) frame.
|
---|
95 | <p> If <em>datafilenamepattern</em> does not exist, is not readable, isn't
|
---|
96 | an image, or some other error occurs, the array ends up empty and
|
---|
97 | <a href="#isValid">isValid</a>() returns FALSE.
|
---|
98 |
|
---|
99 | <h3 class=fn><a name="QCanvasPixmapArray-3"></a>QCanvasPixmapArray::QCanvasPixmapArray ( <a href="qptrlist.html">QPtrList</a><QPixmap> list, <a href="qptrlist.html">QPtrList</a><QPoint> hotspots )
|
---|
100 | </h3>
|
---|
101 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
102 | <p> Use <a href="#QCanvasPixmapArray">QCanvasPixmapArray::QCanvasPixmapArray</a>( <a href="qvaluelist.html">QValueList</a><QPixmap>, <a href="qpointarray.html">QPointArray</a> )
|
---|
103 | instead.
|
---|
104 | <p> Constructs a QCanvasPixmapArray from the list of QPixmaps <em>list</em>. The <em>hotspots</em> list has to be of the same size as <em>list</em>.
|
---|
105 |
|
---|
106 | <h3 class=fn><a name="QCanvasPixmapArray-4"></a>QCanvasPixmapArray::QCanvasPixmapArray ( <a href="qvaluelist.html">QValueList</a><QPixmap> list, <a href="qpointarray.html">QPointArray</a> hotspots = QPointArray ( ) )
|
---|
107 | </h3>
|
---|
108 | Constructs a QCanvasPixmapArray from the list of QPixmaps in the
|
---|
109 | <em>list</em>. Each pixmap will get a hotspot according to the <em>hotspots</em> array. If no hotspots are specified, each one is set to
|
---|
110 | be at position (0, 0).
|
---|
111 | <p> If an error occurs, <a href="#isValid">isValid</a>() will return FALSE.
|
---|
112 |
|
---|
113 | <h3 class=fn><a name="~QCanvasPixmapArray"></a>QCanvasPixmapArray::~QCanvasPixmapArray ()
|
---|
114 | </h3>
|
---|
115 | Destroys the pixmap array and all the pixmaps it contains.
|
---|
116 |
|
---|
117 | <h3 class=fn>uint <a name="count"></a>QCanvasPixmapArray::count () const
|
---|
118 | </h3>
|
---|
119 |
|
---|
120 | <p> Returns the number of pixmaps in the array.
|
---|
121 |
|
---|
122 | <h3 class=fn><a href="qcanvaspixmap.html">QCanvasPixmap</a> * <a name="image"></a>QCanvasPixmapArray::image ( int i ) const
|
---|
123 | </h3>
|
---|
124 |
|
---|
125 | <p> Returns pixmap <em>i</em> in the array, if <em>i</em> is non-negative and less
|
---|
126 | than than <a href="#count">count</a>(), and returns an unspecified value otherwise.
|
---|
127 |
|
---|
128 | <h3 class=fn>bool <a name="isValid"></a>QCanvasPixmapArray::isValid () const
|
---|
129 | </h3>
|
---|
130 | Returns TRUE if the pixmap array is valid; otherwise returns
|
---|
131 | FALSE.
|
---|
132 |
|
---|
133 | <h3 class=fn>bool <a name="operator!"></a>QCanvasPixmapArray::operator! ()
|
---|
134 | </h3>
|
---|
135 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
136 | <p> Use <a href="#isValid">isValid</a>() instead.
|
---|
137 | <p> This returns FALSE if the array is valid, and TRUE if it is not.
|
---|
138 |
|
---|
139 | <h3 class=fn>bool <a name="readCollisionMasks"></a>QCanvasPixmapArray::readCollisionMasks ( const <a href="qstring.html">QString</a> & filename )
|
---|
140 | </h3>
|
---|
141 | Reads new collision masks for the array.
|
---|
142 | <p> By default, <a href="qcanvassprite.html">QCanvasSprite</a> uses the image mask of a sprite to
|
---|
143 | detect collisions. Use this function to set your own collision
|
---|
144 | image masks.
|
---|
145 | <p> If <a href="#count">count</a>() is 1 <em>filename</em> must specify a real filename to read
|
---|
146 | the mask from. If count() is greater than 1, the <em>filename</em> must
|
---|
147 | contain a "%1" that will get replaced by the number of the mask to
|
---|
148 | be loaded, just like <a href="#readPixmaps">QCanvasPixmapArray::readPixmaps</a>().
|
---|
149 | <p> All collision masks must be 1-bit images or this function call
|
---|
150 | will fail.
|
---|
151 | <p> If the file isn't readable, contains the wrong number of images,
|
---|
152 | or there is some other error, this function will return FALSE, and
|
---|
153 | the array will be flagged as invalid; otherwise this function
|
---|
154 | returns TRUE.
|
---|
155 | <p> <p>See also <a href="#isValid">isValid</a>().
|
---|
156 |
|
---|
157 | <h3 class=fn>bool <a name="readPixmaps"></a>QCanvasPixmapArray::readPixmaps ( const <a href="qstring.html">QString</a> & filenamepattern, int fc = 0 )
|
---|
158 | </h3>
|
---|
159 | Reads one or more pixmaps into the pixmap array.
|
---|
160 | <p> If <em>fc</em> is not 0, <em>filenamepattern</em> should contain "%1", e.g.
|
---|
161 | "foo%1.png". The actual filenames are formed by replacing the %1
|
---|
162 | with four-digit integers from 0 to (fc - 1), e.g. foo0000.png,
|
---|
163 | foo0001.png, foo0002.png, etc.
|
---|
164 | <p> If <em>fc</em> is 0, <em>filenamepattern</em> is asssumed to be a filename,
|
---|
165 | and the image contained in this file will be loaded as the first
|
---|
166 | (and only) frame.
|
---|
167 | <p> If <em>filenamepattern</em> does not exist, is not readable, isn't an
|
---|
168 | image, or some other error occurs, this function will return
|
---|
169 | FALSE, and <a href="#isValid">isValid</a>() will return FALSE; otherwise this function
|
---|
170 | will return TRUE.
|
---|
171 | <p> <p>See also <a href="#isValid">isValid</a>().
|
---|
172 |
|
---|
173 | <h3 class=fn>void <a name="setImage"></a>QCanvasPixmapArray::setImage ( int i, <a href="qcanvaspixmap.html">QCanvasPixmap</a> * p )
|
---|
174 | </h3>
|
---|
175 | Replaces the pixmap at index <em>i</em> with pixmap <em>p</em>.
|
---|
176 | <p> The array takes ownership of <em>p</em> and will delete <em>p</em> when the
|
---|
177 | array itself is deleted.
|
---|
178 | <p> If <em>i</em> is beyond the end of the array the array is extended to at
|
---|
179 | least i+1 elements, with elements <a href="#count">count</a>() to i-1 being initialized
|
---|
180 | to 0.
|
---|
181 |
|
---|
182 | <!-- eof -->
|
---|
183 | <hr><p>
|
---|
184 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
185 | Copyright © 1995-2007
|
---|
186 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
187 | <table width=100% cellspacing=0 border=0><tr>
|
---|
188 | <td>Copyright © 2007
|
---|
189 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
190 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
191 | </table></div></address></body>
|
---|
192 | </html>
|
---|