All pastes #55861 Raw Edit

Miscellany

public text v1 · immutable
#55861 ·published 2006-05-14 20:56 UTC
rendered paste body
#!/usr/bin/perl -T
use GD;
use strict;
use warnings;

my $image      = new GD::Image(410,300);
my $background = $image->colorAllocate(167,164,164);
my $black      = $image->colorAllocate(0,0,0);

$image->stringUp(gdMediumBoldFont, 5,130,"Snelheid (km/u)",$black);
$image->string(gdMediumBoldFont, 30,260, "Afstand gelopen (km)", $black);

my $color = $image->colorAllocate(0,0,0);

my @yaxis = ('00', '02', '04', '06', '08', '10', '12', '14', '16');
my @xaxis = ('00', '05', '10', '15', '20', '25');

my $yoffset = 30;
my $ypos    = 30;
my $xoffset = 5;
my $xpos    = 80;

$image->line($yoffset +18, $yoffset -3, 48, 180, $black);
foreach my $yval (reverse @yaxis) {
        $image->string(gdMediumBoldFont, $yoffset, $ypos, $yval, $black);
        $ypos += 25;
}

$ypos = 245;
$image->line($xoffset +40,$xoffset + 240, 200, 245, $black);
foreach my $xval (@xaxis) {
        $image->string(gdMediumBoldFont, $xoffset + 50, $ypos, $xval, $black);
        $xoffset += 25;
}

my $png =  $image->png;
open (PNGOutfile,">/home/wouter/public_html/test.png");
binmode PNGOutfile;
print PNGOutfile $png;
close PNGOutfile;