Syntax-Documentation Inconsistency?
Posted: 2008-09-25T20:46:44-07:00
On the PerlMagick documentation page the following example code is given, intended to draw three red rectangles in a drawing area:
I've tried this (and several variations on this), and it seems to silently fail as if the value for 'points' is invalid.
I'm wondering then, is it the page that's wrong, or is it something on my end?
Also, here's the source to a perl script to try it yourself:
I'd appreciate any insight,
-- Sid
Code: Select all
$image->Draw(fill=>'red', primitive=>'rectangle',
points=>'20,20 100,100 40,40 200,200 60,60 300,300');
I'm wondering then, is it the page that's wrong, or is it something on my end?
Also, here's the source to a perl script to try it yourself:
Code: Select all
#!/usr/bin/perl
use strict;
use warnings;
use Image::Magick;
my $image = Image::Magick->new;
$image->Set('size'=>'320x320');
$image->ReadImage('xc:white');
$image->Draw('fill'=>'red', 'primitive'=>'rectangle',
'points'=>'20,20 100,100 40,40 200,200 60,60 300,300');
# To achieve what was intended by the previous line, uncomment
# the following three:
#$image->Draw('fill'=>'red', 'primitive'=>'rectangle', 'points'=>'20,20 100,100');
#$image->Draw('fill'=>'red', 'primitive'=>'rectangle', 'points'=>'40,40 200,200');
#$image->Draw('fill'=>'red', 'primitive'=>'rectangle', 'points'=>'60,60 300,300');
# The following line may be used to display the image on the screen,
# at least under X11
#$image->Display($ENV{'DISPLAY'});
$image->Write('output.png');
-- Sid