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.
tqt3/doc/html/tqcanvaspixmaparray.html

193 lines
10 KiB

<!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&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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 &lt;<a href="tqcanvas-h.html">tqcanvas.h</a>&gt;</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&nbsp;TQString&nbsp;&amp;&nbsp;datafilenamepattern, int&nbsp;fc = 0 )</li>
<li class=fn>TQCanvasPixmapArray ( TQPtrList&lt;TQPixmap&gt;&nbsp;list, TQPtrList&lt;TQPoint&gt;&nbsp;hotspots ) &nbsp;<em>(obsolete)</em></li>
<li class=fn><a href="#TQCanvasPixmapArray-4"><b>TQCanvasPixmapArray</b></a> ( TQValueList&lt;TQPixmap&gt;&nbsp;list, TQPointArray&nbsp;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&nbsp;TQString&nbsp;&amp;&nbsp;filenamepattern, int&nbsp;fc = 0 )</li>
<li class=fn>bool <a href="#readCollisionMasks"><b>readCollisionMasks</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;filename )</li>
<li class=fn>bool operator! () &nbsp;<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&nbsp;i ) const</li>
<li class=fn>void <a href="#setImage"><b>setImage</b></a> ( int&nbsp;i, TQCanvasPixmap&nbsp;*&nbsp;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&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;datafilenamepattern, int&nbsp;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>&lt;TQPixmap&gt;&nbsp;list, <a href="tqptrlist.html">TQPtrList</a>&lt;TQPoint&gt;&nbsp;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>&lt;TQPixmap&gt;&nbsp;list, <a href="ntqpointarray.html">TQPointArray</a>&nbsp;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>&nbsp;* <a name="image"></a>TQCanvasPixmapArray::image ( int&nbsp;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&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;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&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;filenamepattern, int&nbsp;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&nbsp;i, <a href="tqcanvaspixmap.html">TQCanvasPixmap</a>&nbsp;*&nbsp;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 &copy; 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 &copy; 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>