<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Class: Imlib2::Polygon</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> <script type="text/javascript"> // <![CDATA[ function popupCode( url ) { window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") } function toggleCode( id ) { if ( document.getElementById ) elem = document.getElementById( id ); else if ( document.all ) elem = eval( "document.all." + id ); else return false; elemStyle = elem.style; if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else { elemStyle.display = "none" } return true; } // Make codeblocks hidden by default document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) // ]]> </script> </head> <body> <div id="classHeader"> <table class="header-table"> <tr class="top-aligned-row"> <td><strong>Class</strong></td> <td class="class-name-in-header">Imlib2::Polygon</td> </tr> <tr class="top-aligned-row"> <td><strong>In:</strong></td> <td> <a href="../../files/imlib2_c.html"> imlib2.c </a> (<a href="http://cvs.pablotron.org/cgi-bin/viewcvs.cgi/imlib2-ruby/imlib2.c">CVS</a>) <br /> </td> </tr> <tr class="top-aligned-row"> <td><strong>Parent:</strong></td> <td> Object </td> </tr> </table> </div> <!-- banner header --> <div id="bodyContent"> <div id="contextContent"> </div> <div id="method-list"> <h3 class="section-bar">Methods</h3> <div class="name-list"> <a href="#M000116">add_point</a> <a href="#M000117">bounds</a> <a href="#M000119">contains?</a> <a href="#M000120">contains_point?</a> <a href="#M000118">get_bounds</a> <a href="#M000115">new</a> <a href="#M000114">new</a> </div> </div> </div> <!-- if includes --> <div id="section"> <!-- if method_list --> <div id="methods"> <h3 class="section-bar">Public Class methods</h3> <div id="method-M000115" class="method-detail"> <a name="M000115"></a> <div class="method-heading"> <a href="Polygon.src/M000115.html" target="Code" class="method-signature" onclick="popupCode('Polygon.src/M000115.html');return false;"> <span class="method-name">new</span><span class="method-args">(...)</span> </a> </div> <div class="method-description"> <p> Constructor for <a href="Polygon.html">Imlib2::Polygon</a> </p> <p> Accepts the same arguments as <a href="Polygon.html#M000114">Imlib2::Polygon.new</a>. </p> </div> </div> <div id="method-M000114" class="method-detail"> <a name="M000114"></a> <div class="method-heading"> <a href="Polygon.src/M000114.html" target="Code" class="method-signature" onclick="popupCode('Polygon.src/M000114.html');return false;"> <span class="method-name">new</span><span class="method-args">(...)</span> </a> </div> <div class="method-description"> <p> Return a new <a href="Polygon.html">Imlib2::Polygon</a> </p> <p> Examples: </p> <pre> poly = Imlib2::Polygon.new points = [[10, 10], [20, 30], [15, 8], [6, 3], [12, 2]] poly = Imlib2::Polygon.new *points </pre> </div> </div> <h3 class="section-bar">Public Instance methods</h3> <div id="method-M000116" class="method-detail"> <a name="M000116"></a> <div class="method-heading"> <a href="Polygon.src/M000116.html" target="Code" class="method-signature" onclick="popupCode('Polygon.src/M000116.html');return false;"> <span class="method-name">add_point</span><span class="method-args">(...)</span> </a> </div> <div class="method-description"> <p> Add a point to the polygon </p> <p> Example: </p> <pre> poly.add_point 123, 456 </pre> </div> </div> <div id="method-M000117" class="method-detail"> <a name="M000117"></a> <div class="method-heading"> <a href="Polygon.src/M000117.html" target="Code" class="method-signature" onclick="popupCode('Polygon.src/M000117.html');return false;"> <span class="method-name">bounds</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Return the bounding rectangle of the given polygon. </p> <p> Example: </p> <pre> bounds = poly.bounds %q(x y w h).each_index { |i, v| puts v << ' = ' << bounds[i] } </pre> </div> </div> <div id="method-M000119" class="method-detail"> <a name="M000119"></a> <div class="method-heading"> <a href="Polygon.src/M000119.html" target="Code" class="method-signature" onclick="popupCode('Polygon.src/M000119.html');return false;"> <span class="method-name">contains?</span><span class="method-args">(...)</span> </a> </div> <div class="method-description"> <p> Does the given point lie within the polygon? </p> <p> Example: </p> <pre> if poly.contains? 12, 5 puts 'yes' else puts 'no' end </pre> </div> </div> <div id="method-M000120" class="method-detail"> <a name="M000120"></a> <div class="method-heading"> <a href="Polygon.src/M000120.html" target="Code" class="method-signature" onclick="popupCode('Polygon.src/M000120.html');return false;"> <span class="method-name">contains_point?</span><span class="method-args">(...)</span> </a> </div> <div class="method-description"> <p> Does the given point lie within the polygon? </p> <p> Example: </p> <pre> if poly.contains? 12, 5 puts 'yes' else puts 'no' end </pre> </div> </div> <div id="method-M000118" class="method-detail"> <a name="M000118"></a> <div class="method-heading"> <a href="Polygon.src/M000118.html" target="Code" class="method-signature" onclick="popupCode('Polygon.src/M000118.html');return false;"> <span class="method-name">get_bounds</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Return the bounding rectangle of the given polygon. </p> <p> Example: </p> <pre> bounds = poly.bounds %q(x y w h).each_index { |i, v| puts v << ' = ' << bounds[i] } </pre> </div> </div> </div> </div> <div id="validator-badges"> <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> </div> </body> </html>