#!/usr/bin/perl

use strict;
use warnings;
use GD;

my $image = new GD::Image(100,100);

my $white = $image->colorAllocate(255,255,255);   # background
my $cyan  = $image->colorAllocate(  0,255,255);
my $red   = $image->colorAllocate(255,  0,  0);
my $black = $image->colorAllocate(  0,  0,  0);

use Data::Dumper;
print " --- Here's the red object from GD.pm ---\n";
print Dumper($red);
print " ---------------------------------------\n";

$image->line( 0,0,  50,20,  $red);
$image->line( 50,20, 60,30, $cyan);
$image->setPixel(20,40, $black);
$image->ellipse(80,80, 5,5, $red);

print " --- Here's the image GD.pm ---\n";
print Dumper($image);
print " ---------------------------------------\n";


my $string = $image->jpeg;

my $filename = "test_picture.png";
open(OUTPUT, ">", $filename) 
  or die("couldn't open '$filename' for output");
binmode OUTPUT;

print OUTPUT $image->png;
close OUTPUT;
exit;


