~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/q3canvaspixmaparray.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/qt3support/canvas/q3canvas.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: Q3CanvasPixmapArray Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">Q3CanvasPixmapArray Class Reference</h1>
 
21
<p>The Q3CanvasPixmapArray class provides an array of Q3CanvasPixmaps. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;Q3CanvasPixmapArray&gt;</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 the <a href="porting4.html">Porting Guide</a> for more information.</p>
 
23
<p>Part of the <a href="qt3support.html">Qt3Support</a> module.</p>
 
24
<ul>
 
25
<li><a href="q3canvaspixmaparray-members.html">List of all members, including inherited members</a></li>
 
26
<li><a href="q3canvaspixmaparray-obsolete.html">Obsolete members</a></li>
 
27
</ul>
 
28
<a name="public-functions"></a>
 
29
<h3>Public Functions</h3>
 
30
<ul>
 
31
<li><div class="fn"/><b><a href="q3canvaspixmaparray.html#Q3CanvasPixmapArray">Q3CanvasPixmapArray</a></b> ()</li>
 
32
<li><div class="fn"/><b><a href="q3canvaspixmaparray.html#Q3CanvasPixmapArray-2">Q3CanvasPixmapArray</a></b> ( const QString &amp; <i>datafilenamepattern</i>, int <i>fc</i> = 0 )</li>
 
33
<li><div class="fn"/><b><a href="q3canvaspixmaparray.html#Q3CanvasPixmapArray-4">Q3CanvasPixmapArray</a></b> ( Q3ValueList&lt;QPixmap&gt; <i>list</i>, Q3PointArray <i>hotspots</i> = Q3PointArray() )</li>
 
34
<li><div class="fn"/><b><a href="q3canvaspixmaparray.html#dtor.Q3CanvasPixmapArray">~Q3CanvasPixmapArray</a></b> ()</li>
 
35
<li><div class="fn"/>uint <b><a href="q3canvaspixmaparray.html#count">count</a></b> () const</li>
 
36
<li><div class="fn"/>Q3CanvasPixmap * <b><a href="q3canvaspixmaparray.html#image">image</a></b> ( int <i>i</i> ) const</li>
 
37
<li><div class="fn"/>bool <b><a href="q3canvaspixmaparray.html#isValid">isValid</a></b> () const</li>
 
38
<li><div class="fn"/>bool <b><a href="q3canvaspixmaparray.html#readCollisionMasks">readCollisionMasks</a></b> ( const QString &amp; <i>filename</i> )</li>
 
39
<li><div class="fn"/>bool <b><a href="q3canvaspixmaparray.html#readPixmaps">readPixmaps</a></b> ( const QString &amp; <i>filenamepattern</i>, int <i>fc</i> = 0 )</li>
 
40
<li><div class="fn"/>void <b><a href="q3canvaspixmaparray.html#setImage">setImage</a></b> ( int <i>i</i>, Q3CanvasPixmap * <i>p</i> )</li>
 
41
</ul>
 
42
<a name="details"></a>
 
43
<hr />
 
44
<h2>Detailed Description</h2>
 
45
<p>The Q3CanvasPixmapArray class provides an array of Q3CanvasPixmaps.</p>
 
46
<p>This class is used by <a href="q3canvassprite.html">Q3CanvasSprite</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>
 
47
<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="q3canvaspixmaparray.html#readPixmaps">readPixmaps</a>().</p>
 
48
<p>Individual pixmaps can be set with <a href="q3canvaspixmaparray.html#setImage">setImage</a>() and retrieved with <a href="q3canvaspixmaparray.html#image">image</a>(). The number of pixmaps in the array is returned by <a href="q3canvaspixmaparray.html#count">count</a>().</p>
 
49
<p><a href="q3canvassprite.html">Q3CanvasSprite</a> uses an image's mask for collision detection. You can change this by reading in a separate set of image masks using <a href="q3canvaspixmaparray.html#readCollisionMasks">readCollisionMasks</a>().</p>
 
50
<hr />
 
51
<h2>Member Function Documentation</h2>
 
52
<h3 class="fn"><a name="Q3CanvasPixmapArray"></a>Q3CanvasPixmapArray::Q3CanvasPixmapArray ()</h3>
 
53
<p>Constructs an invalid array (i.e. <a href="q3canvaspixmaparray.html#isValid">isValid</a>() will return false). You must call <a href="q3canvaspixmaparray.html#readPixmaps">readPixmaps</a>() before being able to use this <a href="q3canvaspixmaparray.html">Q3CanvasPixmapArray</a>.</p>
 
54
<h3 class="fn"><a name="Q3CanvasPixmapArray-2"></a>Q3CanvasPixmapArray::Q3CanvasPixmapArray ( const <a href="qstring.html">QString</a> &amp; <i>datafilenamepattern</i>, int <i>fc</i> = 0 )</h3>
 
55
<p>Constructs a <a href="q3canvaspixmaparray.html">Q3CanvasPixmapArray</a> from files.</p>
 
56
<p>The <i>fc</i> parameter sets the number of frames to be loaded for this image.</p>
 
57
<p>If <i>fc</i> is not 0, <i>datafilenamepattern</i> should contain &quot;%1&quot;, e.g. &quot;foo%1.png&quot;. 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>
 
58
<p>If <i>fc</i> is 0, <i>datafilenamepattern</i> is asssumed to be a filename, and the image contained in this file will be loaded as the first (and only) frame.</p>
 
59
<p>If <i>datafilenamepattern</i> does not exist, is not readable, isn't an image, or some other error occurs, the array ends up empty and <a href="q3canvaspixmaparray.html#isValid">isValid</a>() returns false.</p>
 
60
<h3 class="fn"><a name="Q3CanvasPixmapArray-4"></a>Q3CanvasPixmapArray::Q3CanvasPixmapArray ( <a href="q3valuelist.html">Q3ValueList</a>&lt;<a href="qpixmap.html">QPixmap</a>&gt; <i>list</i>, <a href="q3pointarray.html">Q3PointArray</a> <i>hotspots</i> = Q3PointArray() )</h3>
 
61
<p>Constructs a <a href="q3canvaspixmaparray.html">Q3CanvasPixmapArray</a> from the list of QPixmaps in the <i>list</i>. Each pixmap will get a hotspot according to the <i>hotspots</i> array. If no hotspots are specified, each one is set to be at position (0, 0).</p>
 
62
<p>If an error occurs, <a href="q3canvaspixmaparray.html#isValid">isValid</a>() will return false.</p>
 
63
<h3 class="fn"><a name="dtor.Q3CanvasPixmapArray"></a>Q3CanvasPixmapArray::~Q3CanvasPixmapArray ()</h3>
 
64
<p>Destroys the pixmap array and all the pixmaps it contains.</p>
 
65
<h3 class="fn"><a name="count"></a><a href="qtglobal.html#uint-typedef">uint</a> Q3CanvasPixmapArray::count () const</h3>
 
66
<p>Returns the number of pixmaps in the array.</p>
 
67
<h3 class="fn"><a name="image"></a><a href="q3canvaspixmap.html">Q3CanvasPixmap</a> * Q3CanvasPixmapArray::image ( int <i>i</i> ) const</h3>
 
68
<p>Returns pixmap <i>i</i> in the array, if <i>i</i> is non-negative and less than than <a href="q3canvaspixmaparray.html#count">count</a>(), and returns an unspecified value otherwise.</p>
 
69
<h3 class="fn"><a name="isValid"></a>bool Q3CanvasPixmapArray::isValid () const</h3>
 
70
<p>Returns true if the pixmap array is valid; otherwise returns false.</p>
 
71
<h3 class="fn"><a name="readCollisionMasks"></a>bool Q3CanvasPixmapArray::readCollisionMasks ( const <a href="qstring.html">QString</a> &amp; <i>filename</i> )</h3>
 
72
<p>Reads new collision masks for the array.</p>
 
73
<p>By default, <a href="q3canvassprite.html">Q3CanvasSprite</a> uses the image mask of a sprite to detect collisions. Use this function to set your own collision image masks.</p>
 
74
<p>If <a href="q3canvaspixmaparray.html#count">count</a>() is 1 <i>filename</i> must specify a real filename to read the mask from. If <a href="q3canvaspixmaparray.html#count">count</a>() is greater than 1, the <i>filename</i> must contain a &quot;%1&quot; that will get replaced by the number of the mask to be loaded, just like <a href="q3canvaspixmaparray.html#readPixmaps">Q3CanvasPixmapArray::readPixmaps</a>().</p>
 
75
<p>All collision masks must be 1-bit images or this function call will fail.</p>
 
76
<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>
 
77
<p>See also <a href="q3canvaspixmaparray.html#isValid">isValid</a>().</p>
 
78
<h3 class="fn"><a name="readPixmaps"></a>bool Q3CanvasPixmapArray::readPixmaps ( const <a href="qstring.html">QString</a> &amp; <i>filenamepattern</i>, int <i>fc</i> = 0 )</h3>
 
79
<p>Reads one or more pixmaps into the pixmap array.</p>
 
80
<p>If <i>fc</i> is not 0, <i>filenamepattern</i> should contain &quot;%1&quot;, e.g. &quot;foo%1.png&quot;. 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>
 
81
<p>If <i>fc</i> is 0, <i>filenamepattern</i> is asssumed to be a filename, and the image contained in this file will be loaded as the first (and only) frame.</p>
 
82
<p>If <i>filenamepattern</i> does not exist, is not readable, isn't an image, or some other error occurs, this function will return false, and <a href="q3canvaspixmaparray.html#isValid">isValid</a>() will return false; otherwise this function will return true.</p>
 
83
<p>See also <a href="q3canvaspixmaparray.html#isValid">isValid</a>().</p>
 
84
<h3 class="fn"><a name="setImage"></a>void Q3CanvasPixmapArray::setImage ( int <i>i</i>, <a href="q3canvaspixmap.html">Q3CanvasPixmap</a> * <i>p</i> )</h3>
 
85
<p>Replaces the pixmap at index <i>i</i> with pixmap <i>p</i>.</p>
 
86
<p>The array takes ownership of <i>p</i> and will delete <i>p</i> when the array itself is deleted.</p>
 
87
<p>If <i>i</i> is beyond the end of the array the array is extended to at least i+1 elements, with elements <a href="q3canvaspixmaparray.html#count">count</a>() to i-1 being initialized to 0.</p>
 
88
<p /><address><hr /><div align="center">
 
89
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
90
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
91
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
92
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
93
</tr></table></div></address></body>
 
94
</html>