/usr/share/qt3/doc/html/qcanvaspolygonalitem.html is in qt3-doc 3:3.3.8-b-8ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/canvas/qcanvas.cpp:3725 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QCanvasPolygonalItem 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>QCanvasPolygonalItem Class Reference<br><small>[<a href="canvas.html">canvas module</a>]</small></h1>
<p>The QCanvasPolygonalItem class provides a polygonal canvas item
on a QCanvas.
<a href="#details">More...</a>
<p><tt>#include <<a href="qcanvas-h.html">qcanvas.h</a>></tt>
<p>Inherits <a href="qcanvasitem.html">QCanvasItem</a>.
<p>Inherited by <a href="qcanvasrectangle.html">QCanvasRectangle</a>, <a href="qcanvaspolygon.html">QCanvasPolygon</a>, <a href="qcanvasline.html">QCanvasLine</a>, and <a href="qcanvasellipse.html">QCanvasEllipse</a>.
<p><a href="qcanvaspolygonalitem-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QCanvasPolygonalItem"><b>QCanvasPolygonalItem</b></a> ( QCanvas * canvas )</li>
<li class=fn>virtual <a href="#~QCanvasPolygonalItem"><b>~QCanvasPolygonalItem</b></a> ()</li>
<li class=fn>virtual void <a href="#setPen"><b>setPen</b></a> ( QPen p )</li>
<li class=fn>virtual void <a href="#setBrush"><b>setBrush</b></a> ( QBrush b )</li>
<li class=fn>QPen <a href="#pen"><b>pen</b></a> () const</li>
<li class=fn>QBrush <a href="#brush"><b>brush</b></a> () const</li>
<li class=fn>virtual QPointArray <a href="#areaPoints"><b>areaPoints</b></a> () const = 0</li>
<li class=fn>virtual QPointArray <a href="#areaPointsAdvanced"><b>areaPointsAdvanced</b></a> () const</li>
<li class=fn>virtual QRect <a href="#boundingRect"><b>boundingRect</b></a> () const</li>
<li class=fn>virtual int <a href="#rtti"><b>rtti</b></a> () const</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual void <a href="#draw"><b>draw</b></a> ( QPainter & p )</li>
<li class=fn>virtual void <a href="#drawShape"><b>drawShape</b></a> ( QPainter & p ) = 0</li>
<li class=fn>bool <a href="#winding"><b>winding</b></a> () const</li>
<li class=fn>void <a href="#setWinding"><b>setWinding</b></a> ( bool enable )</li>
<li class=fn>void <a href="#invalidate"><b>invalidate</b></a> ()</li>
<li class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The QCanvasPolygonalItem class provides a polygonal canvas item
on a <a href="qcanvas.html">QCanvas</a>.
<p>
<p> The mostly rectangular classes, such as <a href="qcanvassprite.html">QCanvasSprite</a> and
<a href="qcanvastext.html">QCanvasText</a>, use the object's bounding rectangle for movement,
repainting and collision calculations. For most other items, the
bounding rectangle can be far too large -- a diagonal line being
the worst case, and there are many other cases which are also bad.
QCanvasPolygonalItem provides polygon-based bounding rectangle
handling, etc., which is much faster for non-rectangular items.
<p> Derived classes should try to define as small an area as possible
to maximize efficiency, but the polygon must <em>definitely</em> be
contained completely within the polygonal area. Calculating the
exact requirements is usually difficult, but if you allow a small
overestimate it can be easy and quick, while still getting almost
all of QCanvasPolygonalItem's speed.
<p> Note that all subclasses <em>must</em> call <a href="qcanvasitem.html#hide">hide</a>() in their destructor
since hide() needs to be able to access <a href="#areaPoints">areaPoints</a>().
<p> Normally, QCanvasPolygonalItem uses the odd-even algorithm for
determining whether an object intersects this object. You can
change this to the winding algorithm using <a href="#setWinding">setWinding</a>().
<p> The bounding rectangle is available using <a href="#boundingRect">boundingRect</a>(). The
points bounding the polygonal item are retrieved with
areaPoints(). Use <a href="#areaPointsAdvanced">areaPointsAdvanced</a>() to retrieve the bounding
points the polygonal item <em>will</em> have after
<a href="qcanvasitem.html#advance">QCanvasItem::advance</a>(1) has been called.
<p> If the shape of the polygonal item is about to change while the
item is visible, call <a href="#invalidate">invalidate</a>() before updating with a
different result from <a href="#areaPoints">areaPoints</a>().
<p> By default, QCanvasPolygonalItem objects have a black pen and no
brush (the default <a href="qpen.html">QPen</a> and <a href="qbrush.html">QBrush</a> constructors). You can change
this with <a href="#setPen">setPen</a>() and <a href="#setBrush">setBrush</a>(), but note that some
QCanvasPolygonalItem subclasses only use the brush, ignoring the
pen setting.
<p> The polygonal item can be drawn on a painter with <a href="#draw">draw</a>().
Subclasses must reimplement <a href="#drawShape">drawShape</a>() to draw themselves.
<p> Like any other canvas item polygonal items can be moved with
<a href="qcanvasitem.html#move">QCanvasItem::move</a>() and <a href="qcanvasitem.html#moveBy">QCanvasItem::moveBy</a>(), or by setting coordinates
with <a href="qcanvasitem.html#setX">QCanvasItem::setX</a>(), <a href="qcanvasitem.html#setY">QCanvasItem::setY</a>() and <a href="qcanvasitem.html#setZ">QCanvasItem::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 Function Documentation</h2>
<h3 class=fn><a name="QCanvasPolygonalItem"></a>QCanvasPolygonalItem::QCanvasPolygonalItem ( <a href="qcanvas.html">QCanvas</a> * canvas )
</h3>
Constructs a QCanvasPolygonalItem on the canvas <em>canvas</em>.
<h3 class=fn><a name="~QCanvasPolygonalItem"></a>QCanvasPolygonalItem::~QCanvasPolygonalItem ()<tt> [virtual]</tt>
</h3>
Note that all subclasses <em>must</em> call <a href="qcanvasitem.html#hide">hide</a>() in their destructor
since hide() needs to be able to access <a href="#areaPoints">areaPoints</a>().
<h3 class=fn><a href="qpointarray.html">QPointArray</a> <a name="areaPoints"></a>QCanvasPolygonalItem::areaPoints () const<tt> [pure virtual]</tt>
</h3>
<p> This function must be reimplemented by subclasses. It <em>must</em>
return the points bounding (i.e. outside and not touching) the
shape or drawing errors will occur.
<p>Reimplemented in <a href="qcanvaspolygon.html#areaPoints">QCanvasPolygon</a>.
<h3 class=fn><a href="qpointarray.html">QPointArray</a> <a name="areaPointsAdvanced"></a>QCanvasPolygonalItem::areaPointsAdvanced () const<tt> [virtual]</tt>
</h3>
Returns the points the polygonal item <em>will</em> have after
<a href="qcanvasitem.html#advance">QCanvasItem::advance</a>(1) is called, i.e. what the points are when
advanced by the current <a href="qcanvasitem.html#xVelocity">xVelocity</a>() and <a href="qcanvasitem.html#yVelocity">yVelocity</a>().
<h3 class=fn><a href="qrect.html">QRect</a> <a name="boundingRect"></a>QCanvasPolygonalItem::boundingRect () const<tt> [virtual]</tt>
</h3>
Returns the bounding rectangle of the polygonal item, based on
<a href="#areaPoints">areaPoints</a>().
<p>Reimplemented from <a href="qcanvasitem.html#boundingRect">QCanvasItem</a>.
<h3 class=fn><a href="qbrush.html">QBrush</a> <a name="brush"></a>QCanvasPolygonalItem::brush () const
</h3>
<p> Returns the <a href="qbrush.html">QBrush</a> used to fill the item, if filled.
<p> <p>See also <a href="#setBrush">setBrush</a>().
<h3 class=fn>void <a name="draw"></a>QCanvasPolygonalItem::draw ( <a href="qpainter.html">QPainter</a> & p )<tt> [virtual protected]</tt>
</h3>
Reimplemented from <a href="qcanvasitem.html">QCanvasItem</a>, this draws the polygonal item by
setting the pen and brush for the item on the painter <em>p</em> and
calling <a href="#drawShape">drawShape</a>().
<p>Reimplemented from <a href="qcanvasitem.html#draw">QCanvasItem</a>.
<h3 class=fn>void <a name="drawShape"></a>QCanvasPolygonalItem::drawShape ( <a href="qpainter.html">QPainter</a> & p )<tt> [pure virtual protected]</tt>
</h3>
<p> Subclasses must reimplement this function to draw their shape. The
pen and brush of <em>p</em> are already set to <a href="#pen">pen</a>() and <a href="#brush">brush</a>() prior
to calling this function.
<p> <b>Warning:</b> When you reimplement this function, make sure that you
leave the painter in the same state as you found it. For example,
if you start by calling <a href="qpainter.html#translate">QPainter::translate</a>(50, 50), end your
code by calling QPainter::translate(-50, -50). Be also aware that
the painter might already have some transformations set (i.e.,
don't call <a href="qpainter.html#resetXForm">QPainter::resetXForm</a>() when you're done).
<p> <p>See also <a href="#draw">draw</a>().
<p>Reimplemented in <a href="qcanvasrectangle.html#drawShape">QCanvasRectangle</a>, <a href="qcanvaspolygon.html#drawShape">QCanvasPolygon</a>, and <a href="qcanvasellipse.html#drawShape">QCanvasEllipse</a>.
<h3 class=fn>void <a name="invalidate"></a>QCanvasPolygonalItem::invalidate ()<tt> [protected]</tt>
</h3>
Invalidates all information about the area covered by the canvas
item. The item will be updated automatically on the next call that
changes the item's status, for example, <a href="qcanvasitem.html#move">move</a>() or <a href="qcanvasitem.html#update">update</a>(). Call
this function if you are going to change the shape of the item (as
returned by <a href="#areaPoints">areaPoints</a>()) while the item is visible.
<h3 class=fn>bool <a name="isValid"></a>QCanvasPolygonalItem::isValid () const<tt> [protected]</tt>
</h3>
<p> Returns TRUE if the polygonal item's area information has not been
invalidated; otherwise returns FALSE.
<p> <p>See also <a href="#invalidate">invalidate</a>().
<h3 class=fn><a href="qpen.html">QPen</a> <a name="pen"></a>QCanvasPolygonalItem::pen () const
</h3>
<p> Returns the <a href="qpen.html">QPen</a> used to draw the outline of the item, if any.
<p> <p>See also <a href="#setPen">setPen</a>().
<h3 class=fn>int <a name="rtti"></a>QCanvasPolygonalItem::rtti () const<tt> [virtual]</tt>
</h3>
Returns 2 (QCanvasItem::Rtti_PolygonalItem).
<p> <p>See also <a href="qcanvasitem.html#rtti">QCanvasItem::rtti</a>().
<p>Reimplemented from <a href="qcanvasitem.html#rtti">QCanvasItem</a>.
<p>Reimplemented in <a href="qcanvasrectangle.html#rtti">QCanvasRectangle</a>, <a href="qcanvaspolygon.html#rtti">QCanvasPolygon</a>, <a href="qcanvasline.html#rtti">QCanvasLine</a>, and <a href="qcanvasellipse.html#rtti">QCanvasEllipse</a>.
<h3 class=fn>void <a name="setBrush"></a>QCanvasPolygonalItem::setBrush ( <a href="qbrush.html">QBrush</a> b )<tt> [virtual]</tt>
</h3>
Sets the <a href="qbrush.html">QBrush</a> used when drawing the polygonal item to the brush <em>b</em>.
<p> <p>See also <a href="#setPen">setPen</a>(), <a href="#brush">brush</a>(), and <a href="#drawShape">drawShape</a>().
<p>Examples: <a href="canvas-example.html#x2923">canvas/canvas.cpp</a> and <a href="tutorial2-06.html#x2572">chart/chartform_canvas.cpp</a>.
<h3 class=fn>void <a name="setPen"></a>QCanvasPolygonalItem::setPen ( <a href="qpen.html">QPen</a> p )<tt> [virtual]</tt>
</h3>
Sets the <a href="qpen.html">QPen</a> used when drawing the item to the pen <em>p</em>.
Note that many QCanvasPolygonalItems do not use the pen value.
<p> <p>See also <a href="#setBrush">setBrush</a>(), <a href="#pen">pen</a>(), and <a href="#drawShape">drawShape</a>().
<p>Examples: <a href="canvas-example.html#x2924">canvas/canvas.cpp</a> and <a href="tutorial2-06.html#x2573">chart/chartform_canvas.cpp</a>.
<h3 class=fn>void <a name="setWinding"></a>QCanvasPolygonalItem::setWinding ( bool enable )<tt> [protected]</tt>
</h3>
If <em>enable</em> is TRUE, the polygonal item will use the winding
algorithm to determine the "inside" of the polygon; otherwise the
odd-even algorithm will be used.
<p> The default is to use the odd-even algorithm.
<p> <p>See also <a href="#winding">winding</a>().
<h3 class=fn>bool <a name="winding"></a>QCanvasPolygonalItem::winding () const<tt> [protected]</tt>
</h3>
Returns TRUE if the polygonal item uses the winding algorithm to
determine the "inside" of the polygon. Returns FALSE if it uses
the odd-even algorithm.
<p> The default is to use the odd-even algorithm.
<p> <p>See also <a href="#setWinding">setWinding</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt 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>Qt 3.3.8</div>
</table></div></address></body>
</html>
|