diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-08 12:31:36 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-08 12:31:36 -0600 |
commit | d796c9dd933ab96ec83b9a634feedd5d32e1ba3f (patch) | |
tree | 6e3dcca4f77e20ec8966c666aac7c35bd4704053 /doc/html/qcanvassprite.html | |
download | tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.tar.gz tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.zip |
Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731
Diffstat (limited to 'doc/html/qcanvassprite.html')
-rw-r--r-- | doc/html/qcanvassprite.html | 303 |
1 files changed, 303 insertions, 0 deletions
diff --git a/doc/html/qcanvassprite.html b/doc/html/qcanvassprite.html new file mode 100644 index 000000000..8ebff73d7 --- /dev/null +++ b/doc/html/qcanvassprite.html @@ -0,0 +1,303 @@ +<!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:2483 --> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>TQCanvasSprite 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>TQCanvasSprite Class Reference<br><small>[<a href="canvas.html">canvas module</a>]</small></h1> + +<p>The TQCanvasSprite class provides an animated canvas item on a TQCanvas. +<a href="#details">More...</a> +<p><tt>#include <<a href="qcanvas-h.html">qcanvas.h</a>></tt> +<p>Inherits <a href="qcanvasitem.html">TQCanvasItem</a>. +<p><a href="qcanvassprite-members.html">List of all member functions.</a> +<h2>Public Members</h2> +<ul> +<li class=fn><a href="#TQCanvasSprite"><b>TQCanvasSprite</b></a> ( TQCanvasPixmapArray * a, TQCanvas * canvas )</li> +<li class=fn>void <a href="#setSequence"><b>setSequence</b></a> ( TQCanvasPixmapArray * a )</li> +<li class=fn>virtual <a href="#~TQCanvasSprite"><b>~TQCanvasSprite</b></a> ()</li> +<li class=fn>virtual void <a href="#move"><b>move</b></a> ( double nx, double ny, int nf )</li> +<li class=fn>void <a href="#setFrame"><b>setFrame</b></a> ( int f )</li> +<li class=fn>enum <a href="#FrameAnimationType-enum"><b>FrameAnimationType</b></a> { Cycle, Oscillate }</li> +<li class=fn>virtual void <a href="#setFrameAnimation"><b>setFrameAnimation</b></a> ( FrameAnimationType type = Cycle, int step = 1, int state = 0 )</li> +<li class=fn>int <a href="#frame"><b>frame</b></a> () const</li> +<li class=fn>int <a href="#frameCount"><b>frameCount</b></a> () const</li> +<li class=fn>virtual int <a href="#rtti"><b>rtti</b></a> () const</li> +<li class=fn>virtual TQRect <a href="#boundingRect"><b>boundingRect</b></a> () const</li> +<li class=fn>int <a href="#width"><b>width</b></a> () const</li> +<li class=fn>int <a href="#height"><b>height</b></a> () const</li> +<li class=fn>int <a href="#leftEdge"><b>leftEdge</b></a> () const</li> +<li class=fn>int <a href="#topEdge"><b>topEdge</b></a> () const</li> +<li class=fn>int <a href="#rightEdge"><b>rightEdge</b></a> () const</li> +<li class=fn>int <a href="#bottomEdge"><b>bottomEdge</b></a> () const</li> +<li class=fn>int <a href="#leftEdge-2"><b>leftEdge</b></a> ( int nx ) const</li> +<li class=fn>int <a href="#topEdge-2"><b>topEdge</b></a> ( int ny ) const</li> +<li class=fn>int <a href="#rightEdge-2"><b>rightEdge</b></a> ( int nx ) const</li> +<li class=fn>int <a href="#bottomEdge-2"><b>bottomEdge</b></a> ( int ny ) const</li> +<li class=fn>TQCanvasPixmap * <a href="#image"><b>image</b></a> () const</li> +<li class=fn>virtual TQCanvasPixmap * <a href="#imageAdvanced"><b>imageAdvanced</b></a> () const</li> +<li class=fn>TQCanvasPixmap * <a href="#image-2"><b>image</b></a> ( int f ) const</li> +<li class=fn>virtual void <a href="#advance"><b>advance</b></a> ( int phase )</li> +<li class=fn>virtual void <a href="#draw"><b>draw</b></a> ( TQPainter & painter )</li> +</ul> +<hr><a name="details"></a><h2>Detailed Description</h2> + + +The TQCanvasSprite class provides an animated canvas item on a <a href="qcanvas.html">TQCanvas</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="#setSequence">setSequence</a>(). If you +subclass TQCanvasSprite you can change the frame that is displayed +periodically, e.g. whenever <a href="qcanvasitem.html#advance">TQCanvasItem::advance</a>(1) is called to +create the effect of animation. +<p> The current frame can be set with <a href="#setFrame">setFrame</a>() or with <a href="#move">move</a>(). The +number of frames available is given by <a href="#frameCount">frameCount</a>(). The bounding +rectangle of the current frame is returned by <a href="#boundingRect">boundingRect</a>(). +<p> The current frame's image can be retrieved with <a href="#image">image</a>(); use +<a href="#imageAdvanced">imageAdvanced</a>() to retrieve the image for the frame that will be +shown after <a href="#advance">advance</a>(1) is called. Use the image() overload passing +it an integer index to retrieve a particular image from the list of +frames. +<p> Use <a href="#width">width</a>() and <a href="#height">height</a>() to retrieve the dimensions of the current +frame. +<p> Use <a href="#leftEdge">leftEdge</a>() and <a href="#rightEdge">rightEdge</a>() to retrieve the current frame's +left-hand and right-hand x-coordinates respectively. Use +<a href="#bottomEdge">bottomEdge</a>() and <a href="#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> TQCanvasSprite draws very tquickly, at the expense of memory. +<p> The current frame's image can be drawn on a painter with <a href="#draw">draw</a>(). +<p> Like any other canvas item, canvas sprites can be moved with +<a href="#move">move</a>() which sets the x and y coordinates and the frame number, as +well as with <a href="qcanvasitem.html#move">TQCanvasItem::move</a>() and <a href="qcanvasitem.html#moveBy">TQCanvasItem::moveBy</a>(), or by +setting coordinates with <a href="qcanvasitem.html#setX">TQCanvasItem::setX</a>(), <a href="qcanvasitem.html#setY">TQCanvasItem::setY</a>() +and <a href="qcanvasitem.html#setZ">TQCanvasItem::setZ</a>(). +<p> <p>See also <a href="graphics.html">Graphics Classes</a> and <a href="images.html">Image Processing Classes</a>. + +<hr><h2>Member Type Documentation</h2> +<h3 class=fn><a name="FrameAnimationType-enum"></a>TQCanvasSprite::FrameAnimationType</h3> + +<p> This enum is used to identify the different types of frame +animation offered by TQCanvasSprite. +<ul> +<li><tt>TQCanvasSprite::Cycle</tt> - at each advance the frame number will be incremented by +1 (modulo the frame count). +<li><tt>TQCanvasSprite::Oscillate</tt> - 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. +</ul> +<hr><h2>Member Function Documentation</h2> +<h3 class=fn><a name="TQCanvasSprite"></a>TQCanvasSprite::TQCanvasSprite ( <a href="qcanvaspixmaparray.html">TQCanvasPixmapArray</a> * a, <a href="qcanvas.html">TQCanvas</a> * canvas ) +</h3> +Constructs a TQCanvasSprite which uses images from the +<a href="qcanvaspixmaparray.html">TQCanvasPixmapArray</a> <em>a</em>. +<p> The sprite in initially positioned at (0, 0) on <em>canvas</em>, using +frame 0. + +<h3 class=fn><a name="~TQCanvasSprite"></a>TQCanvasSprite::~TQCanvasSprite ()<tt> [virtual]</tt> +</h3> +Destroys the sprite and removes it from the canvas. Does <em>not</em> +delete the images. + +<h3 class=fn>void <a name="advance"></a>TQCanvasSprite::advance ( int phase )<tt> [virtual]</tt> +</h3> +Extends the default <a href="qcanvasitem.html">TQCanvasItem</a> implementation to provide the +functionality of <a href="#setFrameAnimation">setFrameAnimation</a>(). +<p> The <em>phase</em> is 0 or 1: see <a href="qcanvasitem.html#advance">TQCanvasItem::advance</a>() for details. +<p> <p>See also <a href="qcanvasitem.html#advance">TQCanvasItem::advance</a>() and <a href="qcanvasitem.html#setVelocity">setVelocity</a>(). + +<p>Example: <a href="canvas-example.html#x2927">canvas/canvas.cpp</a>. +<p>Reimplemented from <a href="qcanvasitem.html#advance">TQCanvasItem</a>. +<h3 class=fn>int <a name="bottomEdge"></a>TQCanvasSprite::bottomEdge () const +</h3> +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>See also <a href="#leftEdge">leftEdge</a>(), <a href="#rightEdge">rightEdge</a>(), and <a href="#topEdge">topEdge</a>(). + +<h3 class=fn>int <a name="bottomEdge-2"></a>TQCanvasSprite::bottomEdge ( int ny ) const +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<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 +<em>ny</em>. +<p> <p>See also <a href="#leftEdge">leftEdge</a>(), <a href="#rightEdge">rightEdge</a>(), and <a href="#topEdge">topEdge</a>(). + +<h3 class=fn><a href="qrect.html">TQRect</a> <a name="boundingRect"></a>TQCanvasSprite::boundingRect () const<tt> [virtual]</tt> +</h3> +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>Reimplemented from <a href="qcanvasitem.html#boundingRect">TQCanvasItem</a>. +<h3 class=fn>void <a name="draw"></a>TQCanvasSprite::draw ( <a href="qpainter.html">TQPainter</a> & painter )<tt> [virtual]</tt> +</h3> +Draws the current frame's image at the sprite's current position +on painter <em>painter</em>. + +<p>Reimplemented from <a href="qcanvasitem.html#draw">TQCanvasItem</a>. +<h3 class=fn>int <a name="frame"></a>TQCanvasSprite::frame () const +</h3> + +<p> Returns the index of the current animation frame in the +TQCanvasSprite's <a href="qcanvaspixmaparray.html">TQCanvasPixmapArray</a>. +<p> <p>See also <a href="#setFrame">setFrame</a>() and <a href="#move">move</a>(). + +<h3 class=fn>int <a name="frameCount"></a>TQCanvasSprite::frameCount () const +</h3> + +<p> Returns the number of frames in the TQCanvasSprite's +<a href="qcanvaspixmaparray.html">TQCanvasPixmapArray</a>. + +<h3 class=fn>int <a name="height"></a>TQCanvasSprite::height () const +</h3> +The height of the sprite for the current frame's image. +<p> <p>See also <a href="#frame">frame</a>(). + +<h3 class=fn><a href="qcanvaspixmap.html">TQCanvasPixmap</a> * <a name="image"></a>TQCanvasSprite::image () const +</h3> + +<p> Returns the current frame's image. +<p> <p>See also <a href="#frame">frame</a>() and <a href="#setFrame">setFrame</a>(). + +<h3 class=fn><a href="qcanvaspixmap.html">TQCanvasPixmap</a> * <a name="image-2"></a>TQCanvasSprite::image ( int f ) const +</h3> + +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Returns the image for frame <em>f</em>. Does not do any bounds checking on <em>f</em>. + +<h3 class=fn><a href="qcanvaspixmap.html">TQCanvasPixmap</a> * <a name="imageAdvanced"></a>TQCanvasSprite::imageAdvanced () const<tt> [virtual]</tt> +</h3> +Returns the image the sprite <em>will</em> have after <a href="#advance">advance</a>(1) is +called. By default this is the same as <a href="#image">image</a>(). + +<h3 class=fn>int <a name="leftEdge"></a>TQCanvasSprite::leftEdge () const +</h3> +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>See also <a href="#rightEdge">rightEdge</a>(), <a href="#bottomEdge">bottomEdge</a>(), and <a href="#topEdge">topEdge</a>(). + +<h3 class=fn>int <a name="leftEdge-2"></a>TQCanvasSprite::leftEdge ( int nx ) const +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<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 +<em>nx</em>. +<p> <p>See also <a href="#rightEdge">rightEdge</a>(), <a href="#bottomEdge">bottomEdge</a>(), and <a href="#topEdge">topEdge</a>(). + +<h3 class=fn>void <a name="move"></a>TQCanvasSprite::move ( double nx, double ny, int nf )<tt> [virtual]</tt> +</h3> + +<p> Set the position of the sprite to <em>nx</em>, <em>ny</em> and the current +frame to <em>nf</em>. <em>nf</em> will be ignored if it is larger than +<a href="#frameCount">frameCount</a>() or smaller than 0. + +<h3 class=fn>int <a name="rightEdge"></a>TQCanvasSprite::rightEdge () const +</h3> +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>See also <a href="#leftEdge">leftEdge</a>(), <a href="#bottomEdge">bottomEdge</a>(), and <a href="#topEdge">topEdge</a>(). + +<h3 class=fn>int <a name="rightEdge-2"></a>TQCanvasSprite::rightEdge ( int nx ) const +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<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 <em>nx</em>. +<p> <p>See also <a href="#leftEdge">leftEdge</a>(), <a href="#bottomEdge">bottomEdge</a>(), and <a href="#topEdge">topEdge</a>(). + +<h3 class=fn>int <a name="rtti"></a>TQCanvasSprite::rtti () const<tt> [virtual]</tt> +</h3> +Returns 1 (TQCanvasItem::Rtti_Sprite). +<p> <p>See also <a href="qcanvasitem.html#rtti">TQCanvasItem::rtti</a>(). + +<p>Example: <a href="canvas-example.html#x2928">canvas/canvas.cpp</a>. +<p>Reimplemented from <a href="qcanvasitem.html#rtti">TQCanvasItem</a>. +<h3 class=fn>void <a name="setFrame"></a>TQCanvasSprite::setFrame ( int f ) +</h3> +Sets the animation frame used for displaying the sprite to <em>f</em>, +an index into the TQCanvasSprite's <a href="qcanvaspixmaparray.html">TQCanvasPixmapArray</a>. The call +will be ignored if <em>f</em> is larger than <a href="#frameCount">frameCount</a>() or smaller +than 0. +<p> <p>See also <a href="#frame">frame</a>() and <a href="#move">move</a>(). + +<h3 class=fn>void <a name="setFrameAnimation"></a>TQCanvasSprite::setFrameAnimation ( <a href="qcanvassprite.html#FrameAnimationType-enum">FrameAnimationType</a> type = Cycle, int step = 1, int state = 0 )<tt> [virtual]</tt> +</h3> +Sets the animation characteristics for the sprite. +<p> For <em>type</em> == <a href="#FrameAnimationType-enum">Cycle</a>, the frames will increase by <em>step</em> +at each advance, modulo the <a href="#frameCount">frameCount</a>(). +<p> For <em>type</em> == <a href="#FrameAnimationType-enum">Oscillate</a>, the frames will increase by <em>step</em> +at each advance, up to the frameCount(), then decrease by <em>step</em> +back to 0, repeating forever. +<p> The <em>state</em> parameter is for internal use. + +<h3 class=fn>void <a name="setSequence"></a>TQCanvasSprite::setSequence ( <a href="qcanvaspixmaparray.html">TQCanvasPixmapArray</a> * a ) +</h3> +Set the array of images used for displaying the sprite to the +<a href="qcanvaspixmaparray.html">TQCanvasPixmapArray</a> <em>a</em>. +<p> If the current <a href="#frame">frame</a>() is larger than the number of images in <em>a</em>, the current frame will be reset to 0. + +<h3 class=fn>int <a name="topEdge"></a>TQCanvasSprite::topEdge () const +</h3> +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>See also <a href="#leftEdge">leftEdge</a>(), <a href="#rightEdge">rightEdge</a>(), and <a href="#bottomEdge">bottomEdge</a>(). + +<h3 class=fn>int <a name="topEdge-2"></a>TQCanvasSprite::topEdge ( int ny ) const +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<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 +<em>ny</em>. +<p> <p>See also <a href="#leftEdge">leftEdge</a>(), <a href="#rightEdge">rightEdge</a>(), and <a href="#bottomEdge">bottomEdge</a>(). + +<h3 class=fn>int <a name="width"></a>TQCanvasSprite::width () const +</h3> +The width of the sprite for the current frame's image. +<p> <p>See also <a href="#frame">frame</a>(). + +<!-- 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> |