haiku-website/static/legacy-docs/bebook/BPolygon.html

64 lines
14 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!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"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - Classes And Methods - The Interface Kit</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheInterfaceKit.html" title="The Interface Kit" /><link rel="prev" href="BPoint.html" title="BPoint" /><link rel="next" href="BPopUpMenu.html" title="BPopUpMenu" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BPoint.html" title="BPoint"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheInterfaceKit.html" title="The Interface Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BPopUpMenu.html" title="BPopUpMenu"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - Classes And Methods - The Interface Kit</div></div><div id="headerB">Prev: <a href="BPoint.html">BPoint</a>  Up: <a href="TheInterfaceKit.html">The Interface Kit</a>  Next: <a href="BPopUpMenu.html">BPopUpMenu</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPolygon"></a>BPolygon</h2></div></div></div><a id="id1012673" class="indexterm"></a><div class="classheader"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td><table width="100%" border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Derived From:</td><td></td></tr><tr><td>Mix-in Classes:</td><td></td></tr><tr><td>Declared In:</td><td><code class="filename">interface/Polygon.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libbe.so</code></td></tr><tr><td>Allocation:</td><td></td></tr></tbody></table></td><td>
<a class="link overview" href="BPolygon_Overview.html" title="BPolygon">Class Overview</a>
<div class="toc"><ul><li><span class="section"><a href="BPolygon.html#BPolygon_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BPolygon.html#BPolygon_MemberFunctions">Member Functions</a></span></li><li><span class="section"><a href="BPolygon.html#BPolygon_Operators">Operators</a></span></li></ul></div>
</td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPolygon_ConstructorDestructor"></a>Constructor and Destructor</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPolygon_Constructor"></a>BPolygon()</h4></div></div></div><div class="synopsisgroup">
<code class="constructorsynopsis cpp"><span class="methodname">BPolygon</span>(<span class="methodparam"><span class="modifier">const </span><span class="type"><a class="link" href="BPoint.html" title="BPoint"><code class="classname">BPoint</code></a>* </span><span class="parameter">pointList</span></span>,<br />         <span class="methodparam"><span class="type">int32 </span><span class="parameter">numPoints</span></span>);</code>
<code class="constructorsynopsis cpp"><span class="methodname">BPolygon</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">BPolygon* </span><span class="parameter">polygon</span></span>);</code>
<code class="constructorsynopsis cpp"><span class="methodname">BPolygon</span>();</code>
</div><p>
Initializes the <code class="classname">BPolygon</code> by copying
<code class="parameter">numPoints</code> from <code class="parameter">pointList</code>, or by
copying the list of points from another polygon. If one polygon is
constructed from another, the original and the copy won't share any data;
independent memory is allocated for the copy to hold a duplicate list of
points.
</p><p>
If a <code class="classname">BPolygon</code> is constructed without a point list, points must be set
with the <a class="link" href="BPolygon.html#BPolygon_AddPoints" title="AddPoints()"><code class="methodname">AddPoints()</code></a> function.
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPolygon_Destructor"></a>~BPolygon()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="modifier">virtual </span><span class="methodname">~BPolygon</span>();</code><p>
Frees all the memory allocated to hold the list of points.
</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPolygon_MemberFunctions"></a>Member Functions</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPolygon_AddPoints"></a>AddPoints()</h4></div></div></div><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">AddPoints</span>(<span class="methodparam"><span class="modifier">const </span><span class="type"><a class="link" href="BPoint.html" title="BPoint"><code class="classname">BPoint</code></a>* </span><span class="parameter">pointList</span></span>,<br />               <span class="methodparam"><span class="type">int32 </span><span class="parameter">numPoints</span></span>);</code><p>
Appends <code class="parameter">numPoints</code> from <code class="parameter">pointList</code>
to the list of points that already define the polygon.
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPolygon_CountPoints"></a>CountPoints()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">int32 </span><span class="methodname">CountPoints</span>() <span class="modifier">const</span>;</code><p>
Returns the number of points that define the polygon.
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BpolygonFrame"></a>Frame()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type"><a class="link" href="BRect.html" title="BRect"><code class="classname">BRect</code></a> </span><span class="methodname">Frame</span>() <span class="modifier">const</span>;</code><p>
Returns the polygon's frame rectangle—the smallest rectangle that
encloses the entire polygon.
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPolygon_MapTo"></a>MapTo()</h4></div></div></div><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">MapTo</span>(<span class="methodparam"><span class="type"><a class="link" href="BRect.html" title="BRect"><code class="classname">BRect</code></a> </span><span class="parameter">source</span></span>,<br />           <span class="methodparam"><span class="type"><a class="link" href="BRect.html" title="BRect"><code class="classname">BRect</code></a> </span><span class="parameter">destination</span></span>);</code><p>
Modifies the polygon so that it fits the <code class="parameter">destination</code> rectangle exactly as
it originally fit the <code class="parameter">source</code> rectangle. Each vertex of the polygon is
modified so that it has the same proportional position relative to the
sides of the destination rectangle as it originally had to the sides of
the source rectangle.
</p><p>
The polygon doesn't have to be contained in either rectangle. However, to
modify a polygon so that it's exactly inscribed in the destination
rectangle, you should pass its frame rectangle as the source:
</p><pre class="programlisting example cpp"><a class="link" href="BRect.html" title="BRect"><code class="classname">BRect</code></a> <code class="varname">frame</code> = <code class="varname">myPolygon</code>-&gt;<code class="varname">Frame</code>();
<code class="varname">myPolygon</code>-&gt;<code class="methodname">MapTo</code>(<code class="varname">frame</code>, <code class="varname">anotherRect</code>);</pre></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPolygon_PrintToStream"></a>PrintToStream()</h4></div></div></div><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">PrintToStream</span>() <span class="modifier">const</span>;</code><p>
Prints the <code class="classname">BPolygon</code>'s point list to the standard output stream (stdout).
The <a class="link" href="BPoint.html" title="BPoint"><code class="classname">BPoint</code></a> version of this function is called to report each point as a
string in the form
</p><pre class="screen">
"<a class="link" href="BPoint.html" title="BPoint"><code class="classname">BPoint</code></a>(x, y)"
</pre><p>
where x and y stand for the coordinate values of the point in question.
</p><p>
See also:
<a class="link" href="BPoint.html#BPoint_PrintToStream" title="PrintToStream()"><code class="methodname">BPoint::PrintToStream()</code></a>
</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPolygon_Operators"></a>Operators</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BPolygon_operator_equals"></a>= (assignment)</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">BPolygon&amp; </span><span class="methodname">operator =</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">BPolygon&amp; </span></span>);</code><p>
Copies the point list of one <code class="classname">BPolygon</code> object and assigns it to another
<code class="classname">BPolygon</code>. After the assignment, the two objects describe the same
polygon, but are independent of each other. Destroying one of the objects
won't affect the other.
</p></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BPoint.html">BPoint</a>  Up: <a href="TheInterfaceKit.html">The Interface Kit</a>  Next: <a href="BPopUpMenu.html">BPopUpMenu</a> </div><div id="footerB"><div id="footerBL"><a href="BPoint.html" title="BPoint"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheInterfaceKit.html" title="The Interface Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BPopUpMenu.html" title="BPopUpMenu"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>