#!/usr/local/bin/perl
# Change above line to path to your perl binary

use GD;
do "initcolors.pl";

# Create a new image
$im = new GD::Image(640,400);

# Allocate some colors
&InitColors($im);

# Make the background transparent and interlaced
$im->transparent($white);
$im->interlaced('true');

$x1 = 10;
$y1 = 10;
$x2 = 200;
$y2 = 200;

# Draw a border
$im->rectangle(0, 0, 639, 399, $black);
# A line
$im->line($x1,$y1,$x2,$y2,$red);
# A Dashed Line
$im->dashedLine($x1 + 100, $y1, $x2, $y2, $blue);
# Draw a rectangle
$im->rectangle($x1 + 200, $y1, $x2 + 200, $y2, $green);
# A filled rectangle
$im->filledRectangle($x1 + 400, $y1, $x2 + 400, $y2, $brown);
# A circle
$im->arc($x1 + 100, $y1 + 200 + 100, 50, 50, 0, 360, $violet);

# A polygon
# Make the polygon
$poly = new GD::Polygon;
$poly->addPt($x1 + 200, $y1 + 200);
$poly->addPt($x1 + 250, $y1 + 230);
$poly->addPt($x1 + 300, $y1 + 310);
$poly->addPt($x1 + 400, $y1 + 300);
# Draw it
$im->polygon($poly, $yellow);

print $im->png;
