style-light-choice
style-dark-choice 
Avatar
Gary
Vollink.com
9 November 2005

GD Lightning Talk

This will complete the first part of the example:

use GD;

MAIN: {
	my $banner;
	my $head;
	my $img;
	my ( $white, $black, $red, $green, $blue );

	# Create a new image, 400px wide by 66px tall, using truecolor
	$banner = GD::Image->new(400, 66, 1);

	# Allocate colors to use in the image
	$white = $banner->colorAllocate(255,255,255);
	$black = $banner->colorAllocate(0,0,0);
	$red = $banner->colorAllocate(255,0,0);
	$green = $banner->colorAllocate(0,255,0);
	$blue = $banner->colorAllocate(0,0,255);

	# White Background
	$banner->fill(1,1,$white);

	# Box1 and Fill with Blue
	$banner->rectangle(10,10,50,50, $black);
	$banner->fill(11,11, $blue);

	# Box2 and Fill with Green
	$banner->rectangle(70,10,110,50, $black);
	$banner->fill(71,11, $green);

	# Create result 4...
	open($fh, '>', "bn_4.png");
	print $fh $banner->png();
	close($fh);

	# Box2 and Fill with Red
	$banner->rectangle(130,10,170,50, $black);
	$banner->fill(131,11, $red);

	# Create result 5...
	open($fh, '>', "bn_5.png");
	print $fh $banner->png();
	close($fh);
}

Result 4:
banner size rectangle, blue fill square on the left, followed by a green fill square.

Result 5:
banner size rectangle, blue fill square on the left, followed by a green fill square and a red fill square.

Valid CSS!