Subject: | Prima::PS::Drawable clipRect() |
Date: | Sat, 06 Aug 2011 11:45:15 +1000 |
To: | bug-Prima [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
With the prima git the program foo.pl below shows a page in ghostscript
which is white in the top quarter or so and black in the rest, where I
expected an all-black page.
I thought a clipRect() of the drawable width x height would not affect
the bar() drawn. Leaving out the clip gives an all-black page as
expected.
Is it possible the x2,y2 in clipRect are arse about somewhere along the
way? It seems swapping them to
$drawable->clipRect (0,0,$h,$w);;
gives an all-black page. Or do I misunderstand those parameters?
use strict;
use Prima;
use Prima::PS::Drawable;
print Prima->VERSION,"\n";
my $drawable = Prima::PS::Drawable->create (onSpool => sub {
open FH, '>/tmp/x.ps' or die;
print FH $_[1] or die;
close FH;
system "gv /tmp/x.ps";
});
my $w = $drawable->width;
my $h = $drawable->height;
$drawable->begin_doc;
$drawable->color (cl::Black);
$drawable->clipRect (0,0,$w,$h);;
$drawable->bar (0,0, $w,$h);
$drawable->end_doc;
exit 0;