<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- q3canvas.cpp --> <title>Qt 4.8: Q3CanvasSprite Class Reference</title> <link rel="stylesheet" type="text/css" href="style/style.css" /> <script src="scripts/jquery.js" type="text/javascript"></script> <script src="scripts/functions.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="style/superfish.css" /> <link rel="stylesheet" type="text/css" href="style/narrow.css" /> <!--[if IE]> <meta name="MSSmartTagsPreventParsing" content="true"> <meta http-equiv="imagetoolbar" content="no"> <![endif]--> <!--[if lt IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie6.css"> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie7.css"> <![endif]--> <!--[if IE 8]> <link rel="stylesheet" type="text/css" href="style/style_ie8.css"> <![endif]--> <script src="scripts/superfish.js" type="text/javascript"></script> <script src="scripts/narrow.js" type="text/javascript"></script> </head> <body class="" onload="CheckEmptyAndLoadList();"> <div class="header" id="qtdocheader"> <div class="content"> <div id="nav-logo"> <a href="index.html">Home</a></div> <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a> <div id="narrowsearch"></div> <div id="nav-topright"> <ul> <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li> <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li> <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/"> DOC</a></li> <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li> </ul> </div> <div id="shortCut"> <ul> <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li> <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS </a></li> </ul> </div> <ul class="sf-menu" id="narrowmenu"> <li><a href="#">API Lookup</a> <ul> <li><a href="classes.html">Class index</a></li> <li><a href="functions.html">Function index</a></li> <li><a href="modules.html">Modules</a></li> <li><a href="namespaces.html">Namespaces</a></li> <li><a href="qtglobal.html">Global Declarations</a></li> <li><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </li> <li><a href="#">Qt Topics</a> <ul> <li><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li><a href="supported-platforms.html">Supported Platforms</a></li> <li><a href="technology-apis.html">Qt and Key Technologies</a></li> <li><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </li> <li><a href="#">Examples</a> <ul> <li><a href="all-examples.html">Examples</a></li> <li><a href="tutorials.html">Tutorials</a></li> <li><a href="demos.html">Demos</a></li> <li><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </li> </ul> </div> </div> <div class="wrapper"> <div class="hd"> <span></span> </div> <div class="bd group"> <div class="sidebar"> <div class="searchlabel"> Search index:</div> <div class="search" id="sidebarsearch"> <form id="qtdocsearch" action="" onsubmit="return false;"> <fieldset> <input type="text" name="searchstring" id="pageType" value="" /> <div id="resultdialog"> <a href="#" id="resultclose">Close</a> <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span> results:</p> <ul id="resultlist" class="all"> </ul> </div> </fieldset> </form> </div> <div class="box first bottombar" id="lookup"> <h2 title="API Lookup"><span></span> API Lookup</h2> <div id="list001" class="list"> <ul id="ul001" > <li class="defaultLink"><a href="classes.html">Class index</a></li> <li class="defaultLink"><a href="functions.html">Function index</a></li> <li class="defaultLink"><a href="modules.html">Modules</a></li> <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li> <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li> <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </div> </div> <div class="box bottombar" id="topics"> <h2 title="Qt Topics"><span></span> Qt Topics</h2> <div id="list002" class="list"> <ul id="ul002" > <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li class="defaultLink"><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li> <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </div> </div> <div class="box" id="examples"> <h2 title="Examples"><span></span> Examples</h2> <div id="list003" class="list"> <ul id="ul003"> <li class="defaultLink"><a href="all-examples.html">Examples</a></li> <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li> <li class="defaultLink"><a href="demos.html">Demos</a></li> <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </div> </div> </div> <div class="wrap"> <div class="toolbar"> <div class="breadcrumb toolblock"> <ul> <li class="first"><a href="index.html">Home</a></li> <!-- Breadcrumbs go here --> <li><a href="modules.html">Modules</a></li> <li><a href="qt3support.html">Qt3Support</a></li> <li>Q3CanvasSprite</li> </ul> </div> <div class="toolbuttons toolblock"> <ul> <li id="smallA" class="t_button">A</li> <li id="medA" class="t_button active">A</li> <li id="bigA" class="t_button">A</li> <li id="print" class="t_button"><a href="javascript:this.print();"> <span>Print</span></a></li> </ul> </div> </div> <div class="content mainContent"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-types">Public Types</a></li> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <h1 class="title">Q3CanvasSprite Class Reference</h1> <!-- $$$Q3CanvasSprite-brief --> <p>The Q3CanvasSprite class provides an animated canvas item on a <a href="q3canvas.html">Q3Canvas</a>. <a href="#details">More...</a></p> <!-- @@@Q3CanvasSprite --> <pre class="cpp"> <span class="preprocessor">#include <Q3CanvasSprite></span></pre><p><b>This class is part of the Qt 3 support library.</b> It is provided to keep old source code working. We strongly advise against using it in new code. See <a href="porting4.html">Porting to Qt 4</a> for more information.</p> <p><b>Inherits: </b><a href="q3canvasitem.html">Q3CanvasItem</a>.</p> <ul> <li><a href="q3canvassprite-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-types"></a> <h2>Public Types</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#FrameAnimationType-enum">FrameAnimationType</a></b> { Cycle, Oscillate }</td></tr> </table> <a name="public-functions"></a> <h2>Public Functions</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#Q3CanvasSprite">Q3CanvasSprite</a></b> ( Q3CanvasPixmapArray * <i>a</i>, Q3Canvas * <i>canvas</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#dtor.Q3CanvasSprite">~Q3CanvasSprite</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#bottomEdge">bottomEdge</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#bottomEdge-2">bottomEdge</a></b> ( int <i>ny</i> ) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#frame">frame</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#frameCount">frameCount</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#height">height</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> Q3CanvasPixmap * </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#image">image</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> Q3CanvasPixmap * </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#image-2">image</a></b> ( int <i>f</i> ) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual Q3CanvasPixmap * </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#imageAdvanced">imageAdvanced</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#leftEdge">leftEdge</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#leftEdge-2">leftEdge</a></b> ( int <i>nx</i> ) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#move">move</a></b> ( double <i>x</i>, double <i>y</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#move-2">move</a></b> ( double <i>nx</i>, double <i>ny</i>, int <i>nf</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#rightEdge">rightEdge</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#rightEdge-2">rightEdge</a></b> ( int <i>nx</i> ) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#setFrame">setFrame</a></b> ( int <i>f</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#setFrameAnimation">setFrameAnimation</a></b> ( FrameAnimationType <i>type</i> = Cycle, int <i>step</i> = 1, int <i>state</i> = 0 )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#setSequence">setSequence</a></b> ( Q3CanvasPixmapArray * <i>a</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#topEdge">topEdge</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#topEdge-2">topEdge</a></b> ( int <i>ny</i> ) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#width">width</a></b> () const</td></tr> </table> <a name="reimplemented-public-functions"></a> <h2>Reimplemented Public Functions</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#advance">advance</a></b> ( int <i>phase</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QRect </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#boundingRect">boundingRect</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#collidesWith">collidesWith</a></b> ( const Q3CanvasItem * <i>i</i> ) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#draw">draw</a></b> ( QPainter & <i>painter</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="q3canvassprite.html#rtti">rtti</a></b> () const</td></tr> </table> <ul> <li class="fn">34 public functions inherited from <a href="q3canvasitem.html#public-functions">Q3CanvasItem</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li class="fn">1 protected function inherited from <a href="q3canvasitem.html#protected-functions">Q3CanvasItem</a></li> </ul> <a name="details"></a> <!-- $$$Q3CanvasSprite-description --> <div class="descr"> <h2>Detailed Description</h2> <p>The Q3CanvasSprite class provides an animated canvas item on a <a href="q3canvas.html">Q3Canvas</a>.</p> <p>A canvas sprite is an object which can contain any number of images (referred to as frames), only one of which is current, i.e. displayed, at any one time. The images can be passed in the constructor or set or changed later with <a href="q3canvassprite.html#setSequence">setSequence</a>(). If you subclass Q3CanvasSprite you can change the frame that is displayed periodically, e.g. whenever Q3CanvasItem::advance(1) is called to create the effect of animation.</p> <p>The current frame can be set with <a href="q3canvassprite.html#setFrame">setFrame</a>() or with <a href="q3canvassprite.html#move">move</a>(). The number of frames available is given by <a href="q3canvassprite.html#frameCount">frameCount</a>(). The bounding rectangle of the current frame is returned by <a href="q3canvassprite.html#boundingRect">boundingRect</a>().</p> <p>The current frame's image can be retrieved with <a href="q3canvassprite.html#image">image</a>(); use <a href="q3canvassprite.html#imageAdvanced">imageAdvanced</a>() to retrieve the image for the frame that will be shown after advance(1) is called. Use the <a href="q3canvassprite.html#image">image</a>() overload passing it an integer index to retrieve a particular image from the list of frames.</p> <p>Use <a href="q3canvassprite.html#width">width</a>() and <a href="q3canvassprite.html#height">height</a>() to retrieve the dimensions of the current frame.</p> <p>Use <a href="q3canvassprite.html#leftEdge">leftEdge</a>() and <a href="q3canvassprite.html#rightEdge">rightEdge</a>() to retrieve the current frame's left-hand and right-hand x-coordinates respectively. Use <a href="q3canvassprite.html#bottomEdge">bottomEdge</a>() and <a href="q3canvassprite.html#topEdge">topEdge</a>() to retrieve the current frame's bottom and top y-coordinates respectively. These functions have an overload which will accept an integer frame number to retrieve the coordinates of a particular frame.</p> <p>Q3CanvasSprite draws very quickly, at the expense of memory.</p> <p>The current frame's image can be drawn on a painter with <a href="q3canvassprite.html#draw">draw</a>().</p> <p>Like any other canvas item, canvas sprites can be moved with <a href="q3canvassprite.html#move">move</a>() which sets the x and y coordinates and the frame number, as well as with <a href="q3canvasitem.html#move">Q3CanvasItem::move</a>() and <a href="q3canvasitem.html#moveBy">Q3CanvasItem::moveBy</a>(), or by setting coordinates with <a href="q3canvasitem.html#setX">Q3CanvasItem::setX</a>(), <a href="q3canvasitem.html#setY">Q3CanvasItem::setY</a>() and <a href="q3canvasitem.html#setZ">Q3CanvasItem::setZ</a>().</p> </div> <p><b>See also </b><a href="http://www.qt.io/product/">QtCanvas</a> and <a href="graphicsview-porting.html">Porting to Graphics View</a>.</p> <!-- @@@Q3CanvasSprite --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$FrameAnimationType$$$Cycle$$$Oscillate --> <h3 class="fn"><a name="FrameAnimationType-enum"></a>enum Q3CanvasSprite::<span class="name">FrameAnimationType</span></h3> <p>This enum is used to identify the different types of frame animation offered by <a href="q3canvassprite.html" class="compat">Q3CanvasSprite</a>.</p> <table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr> <tr><td class="topAlign"><tt>Q3CanvasSprite::Cycle</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">at each advance the frame number will be incremented by 1 (modulo the frame count).</td></tr> <tr><td class="topAlign"><tt>Q3CanvasSprite::Oscillate</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">at each advance the frame number will be incremented by 1 up to the frame count then decremented to by 1 to 0, repeating this sequence forever.</td></tr> </table> <!-- @@@FrameAnimationType --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$Q3CanvasSprite[overload1]$$$Q3CanvasSpriteQ3CanvasPixmapArray*Q3Canvas* --> <h3 class="fn"><a name="Q3CanvasSprite"></a>Q3CanvasSprite::<span class="name">Q3CanvasSprite</span> ( <span class="type"><a href="q3canvaspixmaparray.html">Q3CanvasPixmapArray</a></span> * <i>a</i>, <span class="type"><a href="q3canvas.html">Q3Canvas</a></span> * <i>canvas</i> )</h3> <p>Constructs a <a href="q3canvassprite.html" class="compat">Q3CanvasSprite</a> which uses images from the <a href="q3canvaspixmaparray.html" class="compat">Q3CanvasPixmapArray</a> <i>a</i>.</p> <p>The sprite in initially positioned at (0, 0) on <i>canvas</i>, using frame 0.</p> <!-- @@@Q3CanvasSprite --> <!-- $$$~Q3CanvasSprite[overload1]$$$~Q3CanvasSprite --> <h3 class="fn"><a name="dtor.Q3CanvasSprite"></a>Q3CanvasSprite::<span class="name">~Q3CanvasSprite</span> ()<tt> [virtual]</tt></h3> <p>Destroys the sprite and removes it from the canvas. Does <i>not</i> delete the images.</p> <!-- @@@~Q3CanvasSprite --> <!-- $$$advance[overload1]$$$advanceint --> <h3 class="fn"><a name="advance"></a><span class="type">void</span> Q3CanvasSprite::<span class="name">advance</span> ( <span class="type">int</span> <i>phase</i> )<tt> [virtual]</tt></h3> <p>Reimplemented from <a href="q3canvasitem.html#advance">Q3CanvasItem::advance</a>().</p> <p>Extends the default <a href="q3canvasitem.html" class="compat">Q3CanvasItem</a> implementation to provide the functionality of <a href="q3canvassprite.html#setFrameAnimation">setFrameAnimation</a>().</p> <p>The <i>phase</i> is 0 or 1: see <a href="q3canvasitem.html#advance">Q3CanvasItem::advance</a>() for details.</p> <p><b>See also </b><a href="q3canvasitem.html#advance">Q3CanvasItem::advance</a>() and <a href="q3canvasitem.html#setVelocity">setVelocity</a>().</p> <!-- @@@advance --> <!-- $$$bottomEdge[overload1]$$$bottomEdge --> <h3 class="fn"><a name="bottomEdge"></a><span class="type">int</span> Q3CanvasSprite::<span class="name">bottomEdge</span> () const</h3> <p>Returns the y-coordinate of the current bottom edge of the sprite. (This may change as the sprite animates since different frames may have different bottom edges.)</p> <p><b>See also </b><a href="q3canvassprite.html#leftEdge">leftEdge</a>(), <a href="q3canvassprite.html#rightEdge">rightEdge</a>(), and <a href="q3canvassprite.html#topEdge">topEdge</a>().</p> <!-- @@@bottomEdge --> <!-- $$$bottomEdge$$$bottomEdgeint --> <h3 class="fn"><a name="bottomEdge-2"></a><span class="type">int</span> Q3CanvasSprite::<span class="name">bottomEdge</span> ( <span class="type">int</span> <i>ny</i> ) const</h3> <p>This is an overloaded function.</p> <p>Returns what the y-coordinate of the top edge of the sprite would be if the sprite (actually its hotspot) were moved to y-position <i>ny</i>.</p> <p><b>See also </b><a href="q3canvassprite.html#leftEdge">leftEdge</a>(), <a href="q3canvassprite.html#rightEdge">rightEdge</a>(), and <a href="q3canvassprite.html#topEdge">topEdge</a>().</p> <!-- @@@bottomEdge --> <!-- $$$boundingRect[overload1]$$$boundingRect --> <h3 class="fn"><a name="boundingRect"></a><span class="type"><a href="qrect.html">QRect</a></span> Q3CanvasSprite::<span class="name">boundingRect</span> () const<tt> [virtual]</tt></h3> <p>Reimplemented from <a href="q3canvasitem.html#boundingRect">Q3CanvasItem::boundingRect</a>().</p> <p>Returns the bounding rectangle for the image in the sprite's current frame. This assumes that the images are tightly cropped (i.e. do not have transparent pixels all along a side).</p> <!-- @@@boundingRect --> <!-- $$$collidesWith[overload1]$$$collidesWithconstQ3CanvasItem* --> <h3 class="fn"><a name="collidesWith"></a><span class="type">bool</span> Q3CanvasSprite::<span class="name">collidesWith</span> ( const <span class="type"><a href="q3canvasitem.html">Q3CanvasItem</a></span> * <i>i</i> ) const<tt> [virtual]</tt></h3> <p>Reimplemented from <a href="q3canvasitem.html#collidesWith">Q3CanvasItem::collidesWith</a>().</p> <!-- @@@collidesWith --> <!-- $$$draw[overload1]$$$drawQPainter& --> <h3 class="fn"><a name="draw"></a><span class="type">void</span> Q3CanvasSprite::<span class="name">draw</span> ( <span class="type"><a href="qpainter.html">QPainter</a></span> & <i>painter</i> )<tt> [virtual]</tt></h3> <p>Reimplemented from <a href="q3canvasitem.html#draw">Q3CanvasItem::draw</a>().</p> <p>Draws the current frame's image at the sprite's current position on painter <i>painter</i>.</p> <!-- @@@draw --> <!-- $$$frame[overload1]$$$frame --> <h3 class="fn"><a name="frame"></a><span class="type">int</span> Q3CanvasSprite::<span class="name">frame</span> () const</h3> <p>Returns the index of the current animation frame in the <a href="q3canvassprite.html" class="compat">Q3CanvasSprite</a>'s <a href="q3canvaspixmaparray.html" class="compat">Q3CanvasPixmapArray</a>.</p> <p><b>See also </b><a href="q3canvassprite.html#setFrame">setFrame</a>() and <a href="q3canvassprite.html#move">move</a>().</p> <!-- @@@frame --> <!-- $$$frameCount[overload1]$$$frameCount --> <h3 class="fn"><a name="frameCount"></a><span class="type">int</span> Q3CanvasSprite::<span class="name">frameCount</span> () const</h3> <p>Returns the number of frames in the <a href="q3canvassprite.html" class="compat">Q3CanvasSprite</a>'s <a href="q3canvaspixmaparray.html" class="compat">Q3CanvasPixmapArray</a>.</p> <!-- @@@frameCount --> <!-- $$$height[overload1]$$$height --> <h3 class="fn"><a name="height"></a><span class="type">int</span> Q3CanvasSprite::<span class="name">height</span> () const</h3> <p>The height of the sprite for the current frame's image.</p> <p><b>See also </b><a href="q3canvassprite.html#frame">frame</a>().</p> <!-- @@@height --> <!-- $$$image[overload1]$$$image --> <h3 class="fn"><a name="image"></a><span class="type"><a href="q3canvaspixmap.html">Q3CanvasPixmap</a></span> * Q3CanvasSprite::<span class="name">image</span> () const</h3> <p>Returns the current frame's image.</p> <p><b>See also </b><a href="q3canvassprite.html#frame">frame</a>() and <a href="q3canvassprite.html#setFrame">setFrame</a>().</p> <!-- @@@image --> <!-- $$$image$$$imageint --> <h3 class="fn"><a name="image-2"></a><span class="type"><a href="q3canvaspixmap.html">Q3CanvasPixmap</a></span> * Q3CanvasSprite::<span class="name">image</span> ( <span class="type">int</span> <i>f</i> ) const</h3> <p>This is an overloaded function.</p> <p>Returns the image for frame <i>f</i>. Does not do any bounds checking on <i>f</i>.</p> <!-- @@@image --> <!-- $$$imageAdvanced[overload1]$$$imageAdvanced --> <h3 class="fn"><a name="imageAdvanced"></a><span class="type"><a href="q3canvaspixmap.html">Q3CanvasPixmap</a></span> * Q3CanvasSprite::<span class="name">imageAdvanced</span> () const<tt> [virtual]</tt></h3> <p>Returns the image the sprite <i>will</i> have after advance(1) is called. By default this is the same as <a href="q3canvassprite.html#image">image</a>().</p> <!-- @@@imageAdvanced --> <!-- $$$leftEdge[overload1]$$$leftEdge --> <h3 class="fn"><a name="leftEdge"></a><span class="type">int</span> Q3CanvasSprite::<span class="name">leftEdge</span> () const</h3> <p>Returns the x-coordinate of the current left edge of the sprite. (This may change as the sprite animates since different frames may have different left edges.)</p> <p><b>See also </b><a href="q3canvassprite.html#rightEdge">rightEdge</a>(), <a href="q3canvassprite.html#bottomEdge">bottomEdge</a>(), and <a href="q3canvassprite.html#topEdge">topEdge</a>().</p> <!-- @@@leftEdge --> <!-- $$$leftEdge$$$leftEdgeint --> <h3 class="fn"><a name="leftEdge-2"></a><span class="type">int</span> Q3CanvasSprite::<span class="name">leftEdge</span> ( <span class="type">int</span> <i>nx</i> ) const</h3> <p>This is an overloaded function.</p> <p>Returns what the x-coordinate of the left edge of the sprite would be if the sprite (actually its hotspot) were moved to x-position <i>nx</i>.</p> <p><b>See also </b><a href="q3canvassprite.html#rightEdge">rightEdge</a>(), <a href="q3canvassprite.html#bottomEdge">bottomEdge</a>(), and <a href="q3canvassprite.html#topEdge">topEdge</a>().</p> <!-- @@@leftEdge --> <!-- $$$move[overload1]$$$movedoubledouble --> <h3 class="fn"><a name="move"></a><span class="type">void</span> Q3CanvasSprite::<span class="name">move</span> ( <span class="type">double</span> <i>x</i>, <span class="type">double</span> <i>y</i> )</h3> <p>Moves the sprite to (<i>x</i>, <i>y</i>).</p> <!-- @@@move --> <!-- $$$move$$$movedoubledoubleint --> <h3 class="fn"><a name="move-2"></a><span class="type">void</span> Q3CanvasSprite::<span class="name">move</span> ( <span class="type">double</span> <i>nx</i>, <span class="type">double</span> <i>ny</i>, <span class="type">int</span> <i>nf</i> )<tt> [virtual]</tt></h3> <p>Moves the sprite to (<i>nx</i>, <i>ny</i>) and sets the current frame to <i>nf</i>. <i>nf</i> will be ignored if it is larger than <a href="q3canvassprite.html#frameCount">frameCount</a>() or smaller than 0.</p> <!-- @@@move --> <!-- $$$rightEdge[overload1]$$$rightEdge --> <h3 class="fn"><a name="rightEdge"></a><span class="type">int</span> Q3CanvasSprite::<span class="name">rightEdge</span> () const</h3> <p>Returns the x-coordinate of the current right edge of the sprite. (This may change as the sprite animates since different frames may have different right edges.)</p> <p><b>See also </b><a href="q3canvassprite.html#leftEdge">leftEdge</a>(), <a href="q3canvassprite.html#bottomEdge">bottomEdge</a>(), and <a href="q3canvassprite.html#topEdge">topEdge</a>().</p> <!-- @@@rightEdge --> <!-- $$$rightEdge$$$rightEdgeint --> <h3 class="fn"><a name="rightEdge-2"></a><span class="type">int</span> Q3CanvasSprite::<span class="name">rightEdge</span> ( <span class="type">int</span> <i>nx</i> ) const</h3> <p>This is an overloaded function.</p> <p>Returns what the x-coordinate of the right edge of the sprite would be if the sprite (actually its hotspot) were moved to x-position <i>nx</i>.</p> <p><b>See also </b><a href="q3canvassprite.html#leftEdge">leftEdge</a>(), <a href="q3canvassprite.html#bottomEdge">bottomEdge</a>(), and <a href="q3canvassprite.html#topEdge">topEdge</a>().</p> <!-- @@@rightEdge --> <!-- $$$rtti[overload1]$$$rtti --> <h3 class="fn"><a name="rtti"></a><span class="type">int</span> Q3CanvasSprite::<span class="name">rtti</span> () const<tt> [virtual]</tt></h3> <p>Reimplemented from <a href="q3canvasitem.html#rtti">Q3CanvasItem::rtti</a>().</p> <p>Returns 1 (<a href="q3canvasitem.html#RttiValues-enum">Q3CanvasItem::Rtti_Sprite</a>).</p> <p><b>See also </b><a href="q3canvasitem.html#rtti">Q3CanvasItem::rtti</a>().</p> <!-- @@@rtti --> <!-- $$$setFrame[overload1]$$$setFrameint --> <h3 class="fn"><a name="setFrame"></a><span class="type">void</span> Q3CanvasSprite::<span class="name">setFrame</span> ( <span class="type">int</span> <i>f</i> )</h3> <p>Sets the animation frame used for displaying the sprite to <i>f</i>, an index into the <a href="q3canvassprite.html" class="compat">Q3CanvasSprite</a>'s <a href="q3canvaspixmaparray.html" class="compat">Q3CanvasPixmapArray</a>. The call will be ignored if <i>f</i> is larger than <a href="q3canvassprite.html#frameCount">frameCount</a>() or smaller than 0.</p> <p><b>See also </b><a href="q3canvassprite.html#frame">frame</a>() and <a href="q3canvassprite.html#move">move</a>().</p> <!-- @@@setFrame --> <!-- $$$setFrameAnimation[overload1]$$$setFrameAnimationFrameAnimationTypeintint --> <h3 class="fn"><a name="setFrameAnimation"></a><span class="type">void</span> Q3CanvasSprite::<span class="name">setFrameAnimation</span> ( <span class="type"><a href="q3canvassprite.html#FrameAnimationType-enum">FrameAnimationType</a></span> <i>type</i> = Cycle, <span class="type">int</span> <i>step</i> = 1, <span class="type">int</span> <i>state</i> = 0 )<tt> [virtual]</tt></h3> <p>Sets the animation characteristics for the sprite.</p> <p>For <i>type</i> == <tt>Cycle</tt>, the frames will increase by <i>step</i> at each advance, modulo the <a href="q3canvassprite.html#frameCount">frameCount</a>().</p> <p>For <i>type</i> == <tt>Oscillate</tt>, the frames will increase by <i>step</i> at each advance, up to the <a href="q3canvassprite.html#frameCount">frameCount</a>(), then decrease by <i>step</i> back to 0, repeating forever.</p> <p>The <i>state</i> parameter is for internal use.</p> <!-- @@@setFrameAnimation --> <!-- $$$setSequence[overload1]$$$setSequenceQ3CanvasPixmapArray* --> <h3 class="fn"><a name="setSequence"></a><span class="type">void</span> Q3CanvasSprite::<span class="name">setSequence</span> ( <span class="type"><a href="q3canvaspixmaparray.html">Q3CanvasPixmapArray</a></span> * <i>a</i> )</h3> <p>Set the array of images used for displaying the sprite to the <a href="q3canvaspixmaparray.html" class="compat">Q3CanvasPixmapArray</a> <i>a</i>.</p> <p>If the current <a href="q3canvassprite.html#frame">frame</a>() is larger than the number of images in <i>a</i>, the current frame will be reset to 0.</p> <!-- @@@setSequence --> <!-- $$$topEdge[overload1]$$$topEdge --> <h3 class="fn"><a name="topEdge"></a><span class="type">int</span> Q3CanvasSprite::<span class="name">topEdge</span> () const</h3> <p>Returns the y-coordinate of the top edge of the sprite. (This may change as the sprite animates since different frames may have different top edges.)</p> <p><b>See also </b><a href="q3canvassprite.html#leftEdge">leftEdge</a>(), <a href="q3canvassprite.html#rightEdge">rightEdge</a>(), and <a href="q3canvassprite.html#bottomEdge">bottomEdge</a>().</p> <!-- @@@topEdge --> <!-- $$$topEdge$$$topEdgeint --> <h3 class="fn"><a name="topEdge-2"></a><span class="type">int</span> Q3CanvasSprite::<span class="name">topEdge</span> ( <span class="type">int</span> <i>ny</i> ) const</h3> <p>This is an overloaded function.</p> <p>Returns what the y-coordinate of the top edge of the sprite would be if the sprite (actually its hotspot) were moved to y-position <i>ny</i>.</p> <p><b>See also </b><a href="q3canvassprite.html#leftEdge">leftEdge</a>(), <a href="q3canvassprite.html#rightEdge">rightEdge</a>(), and <a href="q3canvassprite.html#bottomEdge">bottomEdge</a>().</p> <!-- @@@topEdge --> <!-- $$$width[overload1]$$$width --> <h3 class="fn"><a name="width"></a><span class="type">int</span> Q3CanvasSprite::<span class="name">width</span> () const</h3> <p>The width of the sprite for the current frame's image.</p> <p><b>See also </b><a href="q3canvassprite.html#frame">frame</a>().</p> <!-- @@@width --> </div> </div> </div> </div> <div class="ft"> <span></span> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.</p> <br /> <p> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.</p> <p> Documentation sources may be obtained from <a href="http://www.qt-project.org"> www.qt-project.org</a>.</p> <br /> <p> Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. <a title="Privacy Policy" href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p> </div> <script src="scripts/functions.js" type="text/javascript"></script> </body> </html>