
Newton
Novice
Jun 17, 2010, 7:34 AM
Post #1 of 8
(657 views)
|
|
GD module installed but sample graphics script produces no output
|
Can't Post
|
|
Hi, After installing the GD module from source (to get around the "Can't locate loadable module for GD in @INC" etc). I tried the following sample script (from the book Graphics Programming With Perl by MVerbruggen) and got absolutely no output whatsoever (and also no errors or warnings):
#!/usr/bin/perl -w use strict; use GD; my $gd = GD::Image->new(400,300); my $white = $gd->colorAllocate(255, 255, 255); my $black = $gd->colorAllocate( 0, 0, 0); my $red = $gd->colorAllocate(255, 0, 0); my $green = $gd->colorAllocate( 0, 255, 0); my $blue = $gd->colorAllocate( 0, 0, 255); my $yellow = $gd->colorAllocate(255, 255, 0); $gd->filledRectangle(0, 129, 199, 169, $blue); my $poly = GD::Polygon->new(); $poly->addPt(199, 149); $poly->addPt(399, 74); $poly->addPt(324, 149); $poly->addPt(399, 224); $gd->filledPolygon($poly, $yellow); $gd->polygon ($poly, $black); $gd->arc(199, 149, 250, 250, 0, 360, $red); $gd->arc(199, 149, 100, 200, 0, 360, $red); $gd->fillToBorder(99, 149, $red, $green); $gd->rectangle(0, 0, 399, 299, $red); $gd->line(199, 0, 199, 299, $red); $gd->line(0, 149, 399, 149, $red); I'm working on a Ubuntu 10.04 LTS lucid machine. I'm new to graphics programming and would really like to get up to speed on it. Any help/advice would be greatly appreciated. Thanks in advance.
|