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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/canvas/tqcanvas.cpp:2930 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQCanvasPixmapArray Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQCanvasPixmapArray Class Reference<br><small>[<a href="canvas.html">canvas module</a>]</small></h1>
<p>The TQCanvasPixmapArray class provides an array of TQCanvasPixmaps.
<a href="#details">More...</a>
<p><tt>#include <<a href="tqcanvas-h.html">tqcanvas.h</a>></tt>
<p><a href="tqcanvaspixmaparray-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQCanvasPixmapArray"><b>TQCanvasPixmapArray</b></a> ()</li>
<li class=fn><a href="#TQCanvasPixmapArray-2"><b>TQCanvasPixmapArray</b></a> ( const TQString & datafilenamepattern, int fc = 0 )</li>
<li class=fn>TQCanvasPixmapArray ( TQPtrList<TQPixmap> list, TQPtrList<TQPoint> hotspots ) <em>(obsolete)</em></li>
<li class=fn><a href="#TQCanvasPixmapArray-4"><b>TQCanvasPixmapArray</b></a> ( TQValueList<TQPixmap> list, TQPointArray hotspots = TQPointArray ( ) )</li>
<li class=fn><a href="#~TQCanvasPixmapArray"><b>~TQCanvasPixmapArray</b></a> ()</li>
<li class=fn>bool <a href="#readPixmaps"><b>readPixmaps</b></a> ( const TQString & filenamepattern, int fc = 0 )</li>
<li class=fn>bool <a href="#readCollisionMasks"><b>readCollisionMasks</b></a> ( const TQString & filename )</li>
<li class=fn>bool operator! () <em>(obsolete)</em></li>
<li class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</li>
<li class=fn>TQCanvasPixmap * <a href="#image"><b>image</b></a> ( int i ) const</li>
<li class=fn>void <a href="#setImage"><b>setImage</b></a> ( int i, TQCanvasPixmap * p )</li>
<li class=fn>uint <a href="#count"><b>count</b></a> () const</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQCanvasPixmapArray class provides an array of TQCanvasPixmaps.
<p>
<p> This class is used by <a href="tqcanvassprite.html">TQCanvasSprite</a> 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.
<p> 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 TQPixmaps. You can also
read in a set of pixmaps after construction using <a href="#readPixmaps">readPixmaps</a>().
<p> Individual pixmaps can be set with <a href="#setImage">setImage</a>() and retrieved with
<a href="#image">image</a>(). The number of pixmaps in the array is returned by
<a href="#count">count</a>().
<p> TQCanvasSprite uses an image's mask for collision detection. You
can change this by reading in a separate set of image masks using
<a href="#readCollisionMasks">readCollisionMasks</a>().
<p> <p>See also <a href="graphics.html">Graphics Classes</a> and <a href="images.html">Image Processing Classes</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQCanvasPixmapArray"></a>TQCanvasPixmapArray::TQCanvasPixmapArray ()
</h3>
Constructs an invalid array (i.e. <a href="#isValid">isValid</a>() will return FALSE).
You must call <a href="#readPixmaps">readPixmaps</a>() before being able to use this
TQCanvasPixmapArray.
<h3 class=fn><a name="TQCanvasPixmapArray-2"></a>TQCanvasPixmapArray::TQCanvasPixmapArray ( const <a href="tqstring.html">TQString</a> & datafilenamepattern, int fc = 0 )
</h3>
Constructs a TQCanvasPixmapArray from files.
<p> The <em>fc</em> parameter sets the number of frames to be loaded for
this image.
<p> If <em>fc</em> is not 0, <em>datafilenamepattern</em> 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.
<p> If <em>fc</em> is 0, <em>datafilenamepattern</em> is asssumed to be a
filename, and the image contained in this file will be loaded as
the first (and only) frame.
<p> If <em>datafilenamepattern</em> does not exist, is not readable, isn't
an image, or some other error occurs, the array ends up empty and
<a href="#isValid">isValid</a>() returns FALSE.
<h3 class=fn><a name="TQCanvasPixmapArray-3"></a>TQCanvasPixmapArray::TQCanvasPixmapArray ( <a href="tqptrlist.html">TQPtrList</a><TQPixmap> list, <a href="tqptrlist.html">TQPtrList</a><TQPoint> hotspots )
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Use <a href="#TQCanvasPixmapArray">TQCanvasPixmapArray::TQCanvasPixmapArray</a>( <a href="tqvaluelist.html">TQValueList</a><TQPixmap>, <a href="ntqpointarray.html">TQPointArray</a> )
instead.
<p> Constructs a TQCanvasPixmapArray from the list of TQPixmaps <em>list</em>. The <em>hotspots</em> list has to be of the same size as <em>list</em>.
<h3 class=fn><a name="TQCanvasPixmapArray-4"></a>TQCanvasPixmapArray::TQCanvasPixmapArray ( <a href="tqvaluelist.html">TQValueList</a><TQPixmap> list, <a href="ntqpointarray.html">TQPointArray</a> hotspots = TQPointArray ( ) )
</h3>
Constructs a TQCanvasPixmapArray from the list of TQPixmaps in the
<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
be at position (0, 0).
<p> If an error occurs, <a href="#isValid">isValid</a>() will return FALSE.
<h3 class=fn><a name="~TQCanvasPixmapArray"></a>TQCanvasPixmapArray::~TQCanvasPixmapArray ()
</h3>
Destroys the pixmap array and all the pixmaps it contains.
<h3 class=fn>uint <a name="count"></a>TQCanvasPixmapArray::count () const
</h3>
<p> Returns the number of pixmaps in the array.
<h3 class=fn><a href="tqcanvaspixmap.html">TQCanvasPixmap</a> * <a name="image"></a>TQCanvasPixmapArray::image ( int i ) const
</h3>
<p> Returns pixmap <em>i</em> in the array, if <em>i</em> is non-negative and less
than than <a href="#count">count</a>(), and returns an unspecified value otherwise.
<h3 class=fn>bool <a name="isValid"></a>TQCanvasPixmapArray::isValid () const
</h3>
Returns TRUE if the pixmap array is valid; otherwise returns
FALSE.
<h3 class=fn>bool <a name="operator!"></a>TQCanvasPixmapArray::operator! ()
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Use <a href="#isValid">isValid</a>() instead.
<p> This returns FALSE if the array is valid, and TRUE if it is not.
<h3 class=fn>bool <a name="readCollisionMasks"></a>TQCanvasPixmapArray::readCollisionMasks ( const <a href="tqstring.html">TQString</a> & filename )
</h3>
Reads new collision masks for the array.
<p> By default, <a href="tqcanvassprite.html">TQCanvasSprite</a> uses the image mask of a sprite to
detect collisions. Use this function to set your own collision
image masks.
<p> If <a href="#count">count</a>() is 1 <em>filename</em> must specify a real filename to read
the mask from. If count() is greater than 1, the <em>filename</em> must
contain a "%1" that will get replaced by the number of the mask to
be loaded, just like <a href="#readPixmaps">TQCanvasPixmapArray::readPixmaps</a>().
<p> All collision masks must be 1-bit images or this function call
will fail.
<p> 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.
<p> <p>See also <a href="#isValid">isValid</a>().
<h3 class=fn>bool <a name="readPixmaps"></a>TQCanvasPixmapArray::readPixmaps ( const <a href="tqstring.html">TQString</a> & filenamepattern, int fc = 0 )
</h3>
Reads one or more pixmaps into the pixmap array.
<p> If <em>fc</em> is not 0, <em>filenamepattern</em> 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.
<p> If <em>fc</em> is 0, <em>filenamepattern</em> is asssumed to be a filename,
and the image contained in this file will be loaded as the first
(and only) frame.
<p> If <em>filenamepattern</em> does not exist, is not readable, isn't an
image, or some other error occurs, this function will return
FALSE, and <a href="#isValid">isValid</a>() will return FALSE; otherwise this function
will return TRUE.
<p> <p>See also <a href="#isValid">isValid</a>().
<h3 class=fn>void <a name="setImage"></a>TQCanvasPixmapArray::setImage ( int i, <a href="tqcanvaspixmap.html">TQCanvasPixmap</a> * p )
</h3>
Replaces the pixmap at index <em>i</em> with pixmap <em>p</em>.
<p> The array takes ownership of <em>p</em> and will delete <em>p</em> when the
array itself is deleted.
<p> If <em>i</em> is beyond the end of the array the array is extended to at
least i+1 elements, with elements <a href="#count">count</a>() to i-1 being initialized
to 0.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright © 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>
|