📄 qcanvaspixmaparray.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/src/canvas/qcanvas.cpp:2792 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QCanvasPixmapArray Class</title><style type="text/css"><!--h3.fn,span.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 ofQCanvasPixmaps.<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><div class=fn><a href="#QCanvasPixmapArray"><b>QCanvasPixmapArray</b></a> ()</div></li><li><div class=fn><a href="#QCanvasPixmapArray-2"><b>QCanvasPixmapArray</b></a> ( const QString & datafilenamepattern, int fc = 0 )</div></li><li><div class=fn>QCanvasPixmapArray ( QPtrList<QPixmap> list, QPtrList<QPoint> hotspots ) <em>(obsolete)</em></div></li><li><div class=fn><a href="#QCanvasPixmapArray-4"><b>QCanvasPixmapArray</b></a> ( QValueList<QPixmap> list, QPointArray hotspots = QPointArray ( ) )</div></li><li><div class=fn><a href="#~QCanvasPixmapArray"><b>~QCanvasPixmapArray</b></a> ()</div></li><li><div class=fn>bool <a href="#readPixmaps"><b>readPixmaps</b></a> ( const QString & filenamepattern, int fc = 0 )</div></li><li><div class=fn>bool <a href="#readCollisionMasks"><b>readCollisionMasks</b></a> ( const QString & filename )</div></li><li><div class=fn>bool operator! () <em>(obsolete)</em></div></li><li><div class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</div></li><li><div class=fn>QCanvasPixmap * <a href="#image"><b>image</b></a> ( int i ) const</div></li><li><div class=fn>void <a href="#setImage"><b>setImage</b></a> ( int i, QCanvasPixmap * p )</div></li><li><div class=fn>uint <a href="#count"><b>count</b></a> () const</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2><p> The QCanvasPixmapArray class provides an array ofQCanvasPixmaps.<p> This class is used by <a href="qcanvassprite.html">QCanvasSprite</a> to hold an array of pixmaps. Itis used to implement animated sprites, i.e. images that change overtime, with each pixmap in the array holding one frame.<p> Depending on the constructor you use you can load multiple pixmapsinto the array, either from a directory (specifying a wildcardpattern for the files), or from a list of QPixmaps. You can alsoread 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. Youcan 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 thisQCanvasPixmapArray.<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 thisimage.<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 (andonly) frame.<p> If <em>datafilenamepattern</em> does not exist, is not readable, isn't animage, 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 atposition (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 lessthan 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 detectcollisions. 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 themask from. If count() is greater than 1, the <em>filename</em> mustcontain a "%1" that will get replaced by the number of the mask tobe loaded, similar to <a href="#readPixmaps">QCanvasPixmapArray::readPixmaps</a>().<p> All collision masks must be 1-bit images or this function call willfail.<p> If the file isn't readable, contains the wrong number of images, orthere is some other error, this function will return FALSE,and the array will be flagged as invalid; otherwise this functionreturns 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 (andonly) frame.<p> If <em>filenamepattern</em> does not exist, is not readable, isn't animage, or some other error occurs, this function will return FALSE,and <a href="#isValid">isValid</a>() will return FALSE; otherwise this function will returnTRUE.<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 thearray itself is deleted.<p> If <em>i</em> is beyond the end of the array the array is extended to atleast i+1 elements, with elements <a href="#count">count</a>() to i-1 being initialized to0.<!-- eof --><hr><p>This file is part of the <a href="index.html">Qt toolkit</a>.Copyright © 1995-2002<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 © 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -