Wx::Polygon - Draw and manipulate polygons for wxPerl
This module provides functions for manipulating polygons in wxPerl.
new( POLYGON =
Instantiates a new Wx::Polygon with an array of Wx::Points for a given POLYGON or an ellipse with given parameters.
POLYGON
add_point(x,y,recalc=1) --> void
Adds a point to the polygon. If scale and rotation have been used, rescales and rerotates the polygon after adding the point. If recalc is set to 0, this will not be done, which is better when a lot of points need added.
recalc
0
recalc() --> void
Rescales and rerotates the polygon. This method should be used when a lot of points need to be added. Recalculation can than be done after adding the points.
set_color(r,g,b) --> void
Sets the fill color to wxSOLID with the given r, g and b values.
r
g
b
mid() --> (midx:integer,midy:integer)
Calculates the middle of the polygon (not point 'z') and returns a list with x and y position.
in(x,y) --> boolean
Calculates if (x,y) falls within the edges of the polygon. Returns true if so. Uses algorithm of Randolph Franklin, http://astronomy.swin.edu.au/~pbourke/geometry/insidepoly.
draw( dc:Wx::DC ) --> void
Draws the polygon at given offsets and with given colour(s) to the current DC.
copy() --> Wx::Polygon
Returns a copy of the object.
scale(scale-factor) --> void
Scales the polygon with scale-factor.
scale-factor
rotate(degrees) --> void
Rotates the polygon by degrees degrees (0-360).
degrees
offset(x,y) --> void
Sets the offset for drawing. This can be used to transpose the polygon.
Hans Oesterholt-Dijkema <oesterhol@cpan.org>
(c)2004 Hans Oesterholt-Dijkema. This module can be redistributed under artistic license.
To install Wx::Polygon, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Wx::Polygon
CPAN shell
perl -MCPAN -e shell install Wx::Polygon
For more information on module installation, please visit the detailed CPAN module installation guide.