Subject: | SetRGB on Wx::Rect |
Date: | Sat, 16 Jun 2012 10:07:42 +1000 |
To: | bug-Wx-Perl-Imagick [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
Wx::Image SetRGB() accepts either an X,Y or a Wx::Rect to apply the
given colour. It'd be good if Wx::Perl::Imagick supported a rectangle
too.
Eg. setrect.pl below gets
Use of uninitialized value $b in sprintf at /usr/share/perl5/Wx/Perl/Imagick.pm line 405.
where I hoped it would draw a 2x2 rectangle at 6,6 (in addition to the
one the Wx::Image part puts at 3,3).
#!/usr/bin/perl -w
use strict;
use Wx;
use Wx::Perl::Imagick;
Wx::InitAllImageHandlers();
{
my $image = Wx::Image->new (20, 10);
$image->SetRGB (Wx::Rect->new(3,3, 2,2),
255,0,0);
my $filename = '/tmp/foo.xpm';
$image->SaveFile($filename, Wx::wxBITMAP_TYPE_XPM()) or die;
system ("cat $filename");
}
{
my $image = Wx::Perl::Imagick->new ('/tmp/foo.xpm');
$image->SetRGB (Wx::Rect->new(6,6, 2,2),
0,0,255);
my $filename = '/tmp/bar.xpm';
$image->SaveFile($filename);
system ("cat $filename");
}
exit 0;