1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QPointArray 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: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QPointArray Class Reference</h1><br clear="all">
<p>
The QPointArray class provides an array of points.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qpointarray-h.html">qpointarray.h</a>></code>
<p>
Inherits <a href="qarray.html">QArray</a>.
<p><a href="qpointarray-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#a4de88"><b>QPointArray</b></a>()</div>
<li><div class="fn"><a href="#0d1520"><b>~QPointArray</b></a>()</div>
<li><div class="fn"><a href="#c023af"><b>QPointArray</b></a>(intsize)</div>
<li><div class="fn"><a href="#403efc"><b>QPointArray</b></a>(constQPointArray&a)</div>
<li><div class="fn"><a href="#0d8c75"><b>QPointArray</b></a>(constQRect&r, boolclosed=FALSE)</div>
<li><div class="fn"><a href="#581884"><b>QPointArray</b></a>(intnPoints, constQCOORD*points)</div>
<li><div class="fn">QPointArray&<a href="#6fb407"><b>operator=</b></a>(constQPointArray&a)</div>
<li><div class="fn">QPointArray<a href="#1b87f6"><b>copy</b></a>()const</div>
<li><div class="fn">void<a href="#de09c0"><b>translate</b></a>(intdx, intdy)</div>
<li><div class="fn">QRect<a href="#5f2b49"><b>boundingRect</b></a>()const</div>
<li><div class="fn">void<a href="#78b38c"><b>point</b></a>(uinti, int*x, int*y)const</div>
<li><div class="fn">QPoint<a href="#51444f"><b>point</b></a>(uinti)const</div>
<li><div class="fn">void<a href="#f46929"><b>setPoint</b></a>(uinti, intx, inty)</div>
<li><div class="fn">void<a href="#be343a"><b>setPoint</b></a>(uinti, constQPoint&p)</div>
<li><div class="fn">bool<a href="#2339e5"><b>setPoints</b></a>(intnPoints, constQCOORD*points)</div>
<li><div class="fn">bool<a href="#065697"><b>setPoints</b></a>(intnPoints, intfirstx, intfirsty, ...)</div>
<li><div class="fn">bool<a href="#752a60"><b>putPoints</b></a>(intindex, intnPoints, constQCOORD*points)</div>
<li><div class="fn">bool<a href="#b6ada6"><b>putPoints</b></a>(intindex, intnPoints, intfirstx, intfirsty, ...)</div>
<li><div class="fn">void<a href="#79f0fe"><b>makeArc</b></a>(intx, inty, intw, inth, inta1, inta2)</div>
<li><div class="fn">void<a href="#4b7cea"><b>makeEllipse</b></a>(intx, inty, intw, inth)</div>
<li><div class="fn">void<a href="#60044f"><b>makeArc</b></a>(intx, inty, intw, inth, inta1, inta2, constQWMatrix&)</div>
<li><div class="fn">QPointArray<a href="#147b3c"><b>quadBezier</b></a>()const</div>
<li><div class="fn">void*<b>shortPoints</b>(intindex=0, intnPoints=-1)const(internal)</div>
</ul>
<h2>Static Public Members</h2>
<ul>
<li><div class="fn">void<b>cleanBuffers</b>()(internal)</div>
</ul>
<h2>Related Functions</h2>
(Note that these are not member functions.)
<ul>
<li>QDataStream & <a href="qpointarray.html#976e6a"><b>operator>></b></a> (QDataStream & s, QPointArray & a)
<li>QDataStream & <a href="qpointarray.html#9fa21e"><b>operator<<</b></a> (QDataStream & s, const QPointArray & a)
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QPointArray class provides an array of points.
<p>
The QPointArray is an array of <a href="qpoint.html">QPoint</a> objects. In addition to the
functions provided by <a href="qarray.html">QArray</a>, QPointArray provides some
point-specific functions.
<p>For convenient reading and writing of the point data: <a href="#065697">setPoints</a>(),
<a href="#752a60">putPoints</a>(), <a href="#51444f">point</a>(), and <a href="#be343a">setPoint</a>().
<p>For geometry operations: <a href="#5f2b49">boundingRect</a>() and <a href="#de09c0">translate</a>(). There is
also a <a href="qwmatrix.html#38577f">QWMatrix::map</a>() function for more general transformation of
QPointArrays.
<p>QPointArray is used by <a href="qpainter.html#1793cd">QPainter::drawLineSegments</a>(),
<a href="qpainter.html#bd740e">QPainter::drawPolyline</a>(), <a href="qpainter.html#4dd5bc">QPainter::drawPolygon</a>() and
<a href="qpainter.html#b820f8">QPainter::drawQuadBezier</a>(), among other things.
<p>Note that since this class is a QArray, it is explicitly shared and
works with shallow copies by default.
<p>See also <a href="qpainter.html">QPainter</a>, <a href="qwmatrix.html">QWMatrix</a> and <a href="qarray.html">QArray</a>.
<p>Examples:
<a href="desktop-desktop-cpp.html#QPointArray">desktop/desktop.cpp</a>
<a href="picture-picture-cpp.html#QPointArray">picture/picture.cpp</a>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="a4de88"></a>QPointArray::QPointArray()</h3>
<p>Constructs a null point array.
<p>See also <a href="qarray.html#513bb5">isNull</a>().
<h3 class="fn"><a name="0d8c75"></a>QPointArray::QPointArray(const<a href="qrect.html">QRect</a>&r, boolclosed=FALSE)</h3>
<p>Constructs a point array from the rectangle <em>r.</em>
<p>If <em>closed</em> is FALSE, then the point array just contains the
following four points in the listed order: r.topLeft(),
r.topRight(), r.bottomRight() and r.bottomLeft().
<p>If <em>closed</em> is TRUE, then a fifth point is set to r.topLeft().
<h3 class="fn"><a name="403efc"></a>QPointArray::QPointArray(constQPointArray&a)</h3>
<p>Constructs a shallow copy of the point array <em>a.</em>
<p>See also <a href="#1b87f6">copy</a>().
<h3 class="fn"><a name="581884"></a>QPointArray::QPointArray(intnPoints, constQCOORD*points)</h3>
<p>Constructs a point array with <em>nPoints</em> points, taken from the
<em>points</em> array.
<p>Equivalent to <a href="#065697">setPoints</a>(nPoints,points).
<h3 class="fn"><a name="c023af"></a>QPointArray::QPointArray(intsize)</h3>
<p>Constructs a point array with room for <em>size</em> points. Makes a null
array if <em>size</em> == 0.
<p>See also <a href="qarray.html#a3ecbd">resize</a>() and <a href="qarray.html#513bb5">isNull</a>().
<h3 class="fn"><a name="0d1520"></a>QPointArray::~QPointArray()</h3>
<p>Destructs the point array.
<h3 class="fn"><a href="qrect.html">QRect</a><a name="5f2b49"></a>QPointArray::boundingRect()const</h3>
<p>Returns the bounding rectangle of the points in the array, or
<a href="qrect.html">QRect</a>(0,0,0,0) if the array is empty.
<h3 class="fn">QPointArray<a name="1b87f6"></a>QPointArray::copy()const</h3>
<p>Creates a deep copy of the array.
<h3 class="fn">void<a name="79f0fe"></a>QPointArray::makeArc(intx, inty, intw, inth, inta1, inta2)</h3>
<p>Sets the points of the array to those describing an arc of an
ellipse with size <em>w</em> by <em>h</em> and position (<em>x, y</em> ), starting
from angle <em>a1,</em> spanning <em>a2.</em> The resulting array has sufficient
resolution for pixel accuracy (see the overloaded function which
takes an additional <a href="qwmatrix.html">QWMatrix</a> parameter).
<p>Angles are specified in 16ths of a degree, i.e. a full circle equals
5760 (16*360). Positive values mean counter-clockwise while
negative values mean clockwise direction. Zero degrees is at the 3
o'clock position.
<h3 class="fn">void<a name="60044f"></a>QPointArray::makeArc(intx, inty, intw, inth, inta1, inta2, const<a href="qwmatrix.html">QWMatrix</a>&xf)</h3>
<p>Sets the points of the array to those describing an arc of an
ellipse with size <em>w</em> by <em>h</em> and position (<em>x, y</em> ), starting
from angle <em>a1,</em> spanning <em>a2,</em> transformed by the matrix <em>xf.</em>
The resulting array has sufficient resolution for pixel accuracy.
<p>Angles are specified in 16ths of a degree, i.e. a full circle equals
5760 (16*360). Positive values mean counter-clockwise while negative
values mean clockwise direction. Zero degrees is at the 3 o'clock
position.
<h3 class="fn">void<a name="4b7cea"></a>QPointArray::makeEllipse(intxx, intyy, intw, inth)</h3>
<p>Sets the points of the array to those describing an ellipse with
size <em>w</em> by <em>h</em> and position (<em>x, y</em> ).
<p>The returned array has sufficient resolution for use as pixels.
<h3 class="fn">QPointArray&<a name="6fb407"></a>QPointArray::operator=(constQPointArray&a)</h3>
<p>Assigns a shallow copy of <em>a</em> to this point array and returns a
reference to this point array.
<p>Equivalent to <a href="qarray.html#30ba42">assign</a>( a ).
<p>See also <a href="#1b87f6">copy</a>().
<h3 class="fn"><a href="qpoint.html">QPoint</a><a name="51444f"></a>QPointArray::point(uintindex)const</h3>
<p>Returns the point at position <em>index</em> in the array.
<h3 class="fn">void<a name="78b38c"></a>QPointArray::point(uintindex, int*x, int*y)const</h3>
<p>Returns the point at position <em>index</em> in the array in <em>*x</em> and <em>*y.</em>
<h3 class="fn">bool<a name="752a60"></a>QPointArray::putPoints(intindex, intnPoints, constQCOORD*points)</h3>
<p>Copies <em>nPoints</em> points from the <em>points</em> array into this point array.
Will resize this point array if <code>index+nPoints</code> exceeds
the size of the array.
<p>Returns TRUE if successful, or FALSE if the array could not be
resized (typcailly due to lack of memory).
<p>The example code creates an array with three points: (1,2), (3,4)
and (5,6):
<pre> <a href="qpointarray.html">QPointArray</a> a( 1 );
a[0] = QPoint( 1, 2 );
static QCOORD points[] = { 3,4, 5,6 };
a.<a href="#752a60">putPoints</a>( 1, 2, points );
</pre>
<p>This function differs from <a href="#065697">setPoints</a>() in that it does not resize the
array unless the array size is exceeded.
<p>See also <a href="qarray.html#a3ecbd">resize</a>() and <a href="#065697">setPoints</a>().
<h3 class="fn">bool<a name="b6ada6"></a>QPointArray::putPoints(intindex, intnPoints, intfirstx, intfirsty, ...)</h3>
<p>Copies <em>nPoints</em> points from the variable argument list into this point
array. Will resize this point array if <code>index+nPoints</code> exceeds
the size of the array.
<p>Returns TRUE if successful, or FALSE if the array could not be
resized (typically due to lack of memory).
<p>The example code creates an array with two points (1,2), (3,4) and (5,6):
<pre> <a href="qpointarray.html">QPointArray</a> a( 1 );
a[0] = QPoint( 1, 2 );
a.<a href="#752a60">putPoints</a>( 1, 2, 3,4, 5,6 );
</pre>
<p>This function differs from <a href="#065697">setPoints</a>() in that it does not resize the
array unless the array size is exceeded.
<p>See also <a href="qarray.html#a3ecbd">resize</a>() and <a href="#065697">setPoints</a>().
<h3 class="fn">QPointArray<a name="147b3c"></a>QPointArray::quadBezier()const</h3>
<p>Returns the Bezier points for the four control points in this array.
<h3 class="fn">void<a name="be343a"></a>QPointArray::setPoint(uinti, const<a href="qpoint.html">QPoint</a>&p)</h3>
<p>Equivalent to setPoint( i, p.x(), p.y() ).
<h3 class="fn">void<a name="f46929"></a>QPointArray::setPoint(uintindex, intx, inty)</h3>
<p>Sets the point at position <em>index</em> in the array to <em>(x,y).</em>
<h3 class="fn">bool<a name="2339e5"></a>QPointArray::setPoints(intnPoints, constQCOORD*points)</h3>
<p>Resizes the array to <em>nPoints</em> and sets the points in the array to
the values taken from <em>points.</em>
<p>Returns TRUE if successful, or FALSE if the array could not be
resized (normally due to lack of memory).
<p>The example code creates an array with two points (1,2) and (3,4):
<pre> static QCOORD points[] = { 1,2, 3,4 };
<a href="qpointarray.html">QPointArray</a> a;
a.<a href="#065697">setPoints</a>( 2, points );
</pre>
<p>See also <a href="qarray.html#a3ecbd">resize</a>() and <a href="#752a60">putPoints</a>().
<h3 class="fn">bool<a name="065697"></a>QPointArray::setPoints(intnPoints, intfirstx, intfirsty, ...)</h3>
<p>Resizes the array to <em>nPoints</em> and sets the points in the array to
the values taken from the variable argument list.
<p>Returns TRUE if successful, or FALSE if the array could not be
resized (typically due to lack of memory).
<p>The example code creates an array with two points (1,2) and (3,4):
<p><pre> <a href="qpointarray.html">QPointArray</a> a;
a.<a href="#065697">setPoints</a>( 2, 1,2, 3,4 );
</pre>
<p>See also <a href="qarray.html#a3ecbd">resize</a>() and <a href="#752a60">putPoints</a>().
<h3 class="fn">void<a name="de09c0"></a>QPointArray::translate(intdx, intdy)</h3>
<p>Translates all points in the array <em>(dx,dy).</em>
<h3 class="fn">void<a name="e54123"></a>QPointArray::cleanBuffers() <code>[static]</code></h3>
<p>For internal use only.
<h3 class="fn">void*<a name="c91a13"></a>QPointArray::shortPoints(intindex=0, intnPoints=-1)const</h3>
<p>For internal use only.
<hr><h2>Related Functions</h2>
<h3><a href="qdatastream.html">QDataStream</a> & <a name="976e6a"></a>operator>> (<a href="qdatastream.html">QDataStream</a> & s, QPointArray & a)</h3>
<p>Reads a point array from the stream and returns a reference to the stream.
<p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>
<h3><a href="qdatastream.html">QDataStream</a> & <a name="9fa21e"></a>operator<< (<a href="qdatastream.html">QDataStream</a> & s, const QPointArray & a)</h3>
<p>Writes a point array to the stream and returns a reference to the stream.
<p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.1"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2000
<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 2000 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.1</div>
</table></div></address></body></html>
|