#!/usr/local/bin/perl -w use strict; use GD; my %arcdata = ( topRight => [ 0, 24, 50, 50, 270, 360 ], topLeft => [ 24, 24, 50, 50, 180, 270 ], bottomRight => [ 0, 0, 50, 50, 0, 90 ], bottomLeft => [ 24, 0, 50, 50, 90, 180 ] ); for my $orientation ( keys %arcdata ) { my @insertdata = @{ $arcdata{$orientation} }; my $img = new GD::Image (25, 25); my $white = $img->colorAllocate(255,255,255); $img->transparent($white); my $black = $img->colorAllocate(0,0,0); $img->arc(@insertdata, $black); my $red = $img->colorAllocate(255,0,0); $img->fill( @insertdata[0,1], $red); open (IMAGEOUT,">$orientation.png") || die "Can't write to $orientation.png: $!\n"; binmode (IMAGEOUT); print IMAGEOUT $img->png(); close (IMAGEOUT); print "wrote $orientation.png\n"; }