From: Tony Cook Date: Mon, 19 Nov 2001 12:39:35 +0000 (+0000) Subject: fix polygon() call sequence X-Git-Tag: Imager-0.48^2~485 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/ec88fc0a60d598e0136e52a1e7cde74d03045583?ds=inline fix polygon() call sequence mention polygons in list at top of Drawing Methods move mentions of general fills to bottom of Drawing methods and give a bit more info --- diff --git a/Imager.pm b/Imager.pm index d6a9a67b..461e3388 100644 --- a/Imager.pm +++ b/Imager.pm @@ -2922,8 +2922,8 @@ IMPLEMENTATION MORE OR LESS DONE CHECK THE TESTS DOCUMENTATION OF THIS SECTION OUT OF SYNC It is possible to draw with graphics primitives onto images. Such -primitives include boxes, arcs, circles and lines. A reference -oriented list follows. +primitives include boxes, arcs, circles, polygons and lines. A +reference oriented list follows. Box: $img->box(color=>$blue,xmin=>10,ymin=>30,xmax=>200,ymax=>300,filled=>1); @@ -2941,18 +2941,6 @@ Arc: This creates a filled red arc with a 'center' at (200, 100) and spans 10 degrees and the slice has a radius of 20. SEE section on BUGS. -Both the arc() and box() methods can take a C parameter which -can either be an Imager::Fill object, or a reference to a hash -containing the parameters used to create the fill: - - $img->box(xmin=>10, ymin=>30, xmax=>150, ymax=>60, - fill => { hatch=>'cross2' }); - use Imager::Fill; - my $fill = Imager::Fill->new(hatch=>'stipple'); - $img->box(fill=>$fill); - -See L for the type of fills you can use. - Circle: $img->circle(color=>$green, r=50, x=>200, y=>100); @@ -2976,13 +2964,14 @@ other way is to specify two array references. Polygon: $img->polygon(points=>[[$x0,$y0],[$x1,$y1],[$x2,$y2]],color=>$red); - $img->polyline(x=>[$x0,$x1,$x2], y=>[$y0,$y1,$y2]); + $img->polygon(x=>[$x0,$x1,$x2], y=>[$y0,$y1,$y2]); Polygon is used to draw a filled polygon. Currently the polygon is always drawn antialiased, although that will change in the future. Like other antialiased drawing functions its coordinates can be specified with floating point values. +Flood Fill: You can fill a region that all has the same color using the flood_fill() method, for example: @@ -2991,12 +2980,19 @@ flood_fill() method, for example: will fill all regions the same color connected to the point (50, 50). -You can also use a general fill, so you could fill the same region -with a check pattern using: +The arc(), box(), polygon() and flood_fill() methods can take a +C parameter which can either be an Imager::Fill object, or a +reference to a hash containing the parameters used to create the fill: - $img->flood_fill(x=>50, y=>50, fill=>{ hatch=>'check2x2' }); + $img->box(xmin=>10, ymin=>30, xmax=>150, ymax=>60, + fill => { hatch=>'cross2' }); + use Imager::Fill; + my $fill = Imager::Fill->new(hatch=>'stipple'); + $img->box(fill=>$fill); -See L for more information on general fills. +Currently you can create opaque or transparent plain color fills, +hatched fills, image based fills and fountain fills. See +L for more information. =head2 Text rendering