You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
193 lines
10 KiB
193 lines
10 KiB
14 years ago
|
<!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/qcanvas.cpp:2930 -->
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>QCanvasPixmapArray 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>QCanvasPixmapArray Class Reference<br><small>[<a href="canvas.html">canvas module</a>]</small></h1>
|
||
|
|
||
|
<p>The QCanvasPixmapArray class provides an array of QCanvasPixmaps.
|
||
|
<a href="#details">More...</a>
|
||
|
<p><tt>#include <<a href="qcanvas-h.html">qcanvas.h</a>></tt>
|
||
|
<p><a href="qcanvaspixmaparray-members.html">List of all member functions.</a>
|
||
|
<h2>Public Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn><a href="#QCanvasPixmapArray"><b>QCanvasPixmapArray</b></a> ()</li>
|
||
|
<li class=fn><a href="#QCanvasPixmapArray-2"><b>QCanvasPixmapArray</b></a> ( const QString & datafilenamepattern, int fc = 0 )</li>
|
||
|
<li class=fn>QCanvasPixmapArray ( QPtrList<QPixmap> list, QPtrList<QPoint> hotspots ) <em>(obsolete)</em></li>
|
||
|
<li class=fn><a href="#QCanvasPixmapArray-4"><b>QCanvasPixmapArray</b></a> ( QValueList<QPixmap> list, QPointArray hotspots = QPointArray ( ) )</li>
|
||
|
<li class=fn><a href="#~QCanvasPixmapArray"><b>~QCanvasPixmapArray</b></a> ()</li>
|
||
|
<li class=fn>bool <a href="#readPixmaps"><b>readPixmaps</b></a> ( const QString & filenamepattern, int fc = 0 )</li>
|
||
|
<li class=fn>bool <a href="#readCollisionMasks"><b>readCollisionMasks</b></a> ( const QString & 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>QCanvasPixmap * <a href="#image"><b>image</b></a> ( int i ) const</li>
|
||
|
<li class=fn>void <a href="#setImage"><b>setImage</b></a> ( int i, QCanvasPixmap * 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 QCanvasPixmapArray class provides an array of QCanvasPixmaps.
|
||
|
|
||
|
<p>
|
||
|
|
||
|
|
||
|
<p> This class is used by <a href="qcanvassprite.html">QCanvasSprite</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 QPixmaps. 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> QCanvasSprite 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="QCanvasPixmapArray"></a>QCanvasPixmapArray::QCanvasPixmapArray ()
|
||
|
</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
|
||
|
QCanvasPixmapArray.
|
||
|
|
||
|
<h3 class=fn><a name="QCanvasPixmapArray-2"></a>QCanvasPixmapArray::QCanvasPixmapArray ( const <a href="qstring.html">QString</a> & datafilenamepattern, int fc = 0 )
|
||
|
</h3>
|
||
|
Constructs a QCanvasPixmapArray 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="QCanvasPixmapArray-3"></a>QCanvasPixmapArray::QCanvasPixmapArray ( <a href="qptrlist.html">QPtrList</a><QPixmap> list, <a href="qptrlist.html">QPtrList</a><QPoint> 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="#QCanvasPixmapArray">QCanvasPixmapArray::QCanvasPixmapArray</a>( <a href="qvaluelist.html">QValueList</a><QPixmap>, <a href="qpointarray.html">QPointArray</a> )
|
||
|
instead.
|
||
|
<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>.
|
||
|
|
||
|
<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 ( ) )
|
||
|
</h3>
|
||
|
Constructs a QCanvasPixmapArray from the list of QPixmaps 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="~QCanvasPixmapArray"></a>QCanvasPixmapArray::~QCanvasPixmapArray ()
|
||
|
</h3>
|
||
|
Destroys the pixmap array and all the pixmaps it contains.
|
||
|
|
||
|
<h3 class=fn>uint <a name="count"></a>QCanvasPixmapArray::count () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the number of pixmaps in the array.
|
||
|
|
||
|
<h3 class=fn><a href="qcanvaspixmap.html">QCanvasPixmap</a> * <a name="image"></a>QCanvasPixmapArray::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>QCanvasPixmapArray::isValid () const
|
||
|
</h3>
|
||
|
Returns TRUE if the pixmap array is valid; otherwise returns
|
||
|
FALSE.
|
||
|
|
||
|
<h3 class=fn>bool <a name="operator!"></a>QCanvasPixmapArray::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>QCanvasPixmapArray::readCollisionMasks ( const <a href="qstring.html">QString</a> & filename )
|
||
|
</h3>
|
||
|
Reads new collision masks for the array.
|
||
|
<p> By default, <a href="qcanvassprite.html">QCanvasSprite</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">QCanvasPixmapArray::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>QCanvasPixmapArray::readPixmaps ( const <a href="qstring.html">QString</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>QCanvasPixmapArray::setImage ( int i, <a href="qcanvaspixmap.html">QCanvasPixmap</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">Qt 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>Qt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|