Algorithm-BreakOverlappingRectangles
view release on metacpan or search on metacpan
samples/s4.pl view on Meta::CPAN
$im->rectangle(0,0,999,999, $white);
for ($a->get_rectangles) {
my ($x0, $y0, $x1, $y1, @ids) = @{$_};
my $color = $colors[128 * rand];
$im->rectangle($x0, $y0, $x1 - 1, $y1 - 1, $color);
$im->string(gdSmallFont, $x0, ($y0+$y1)/2, "[@ids]", $color);
}
open my $file, '>', 'image.png';
print $file $im->png;
close $file;
( run in 3.419 seconds using v1.01-cache-2.11-cpan-df04353d9ac )