use GD;
use warnings;
use strict;
my $ttf_path='/cygdrive/c/windows/fonts';
my $image = new GD::Image(400,100);
#$image->alphaBlending(0);
my $white = $image->colorAllocate(255,255,255);
my $black = $image->colorAllocate( 0, 0, 0);
my $red = $image->colorAllocate(255, 0, 0);
my $blue = $image->colorAllocate( 0, 0,255);
$image->transparent($white);
# Filling background black
$image->fill(10, 10, $black);
$image->rectangle(10,10,20,20,$white);
# Drawing oval...
$image->arc(50,50,95,75,0,360,$blue);
# ... filling it red
$image->fill(50,50,$red);
# printing bla bla
$image->stringFT($red, "$ttf_path/verdana.ttf", 12, 3.1415/2, 150, 80, "Bla bla");
my $brush_1=circle_brush(0, 255, 0, 20);
$image->setBrush($brush_1);
$image->line (0,0, 399, 99, gdBrushed);
my $brush_2=circle_brush(0, 0, 250, 20);
$image->setBrush($brush_2);
$image->line (0,99, 399, 0, gdBrushed);
$image->line (50,50, 50,50, gdBrushed);
open JPG, ">test.gif";
print JPG $image->gif;
close JPG;
sub circle_brush {
my $red =shift;
my $green =shift;
my $blue =shift;
my $radius=shift;
my $brush = new GD::Image(2*$radius-1, 2*$radius-1);
my $transparent = $brush->colorAllocate(0,0,0);
$brush->transparent($transparent);
for (my $i=0; $i<$radius; $i++) {
my $color = $brush->colorAllocateAlpha($red, $green, $blue,50);
$brush -> arc($radius, $radius, $i, $i, 0, 360, $color);
}
return $brush;
}