Dear Monks,I used to capture a postscript image (which consisted of a graph with nodes and edges) in Tk::Canvas using a code as below :
my ($miny, $maxy) = (1000000000000000000, -1000000000000000000);
my ($minx, $maxx) = (1000000000000000000, -1000000000000000000);
## Stored all node coordinate information in @graph_node
for(my $i=0;$i<@graph_node;$i++)
{
my ($x,$y) = $graph_node[$i]->get_coords;
$maxy = $y if $y > $maxy;
$miny = $y if $y < $miny;
$maxx = $x if $x > $maxx;
$minx = $x if $x < $minx;
}
$maxx = $maxx + 90;
$maxy = $maxy + 90;
$minx = $minx - 90;
$miny = $miny - 90;
@capture=('-x'=>$minx,'-y'=>$miny,-height=>$maxy-$miny,-width
+=>$maxx-$minx);
$scrolled_can->postscript(-colormode=>'color',
-file=> "$screenshot_path",
-rotate=>0,
-width=>2400,
-height=>3400,
@capture);
I used the above strategy instead of
my ($xt0,$yt0,$xt1,$yt1) = $_canvas{0}->bbox('all');
because sometimes the bbox capture did not capture the canvas properly .
Now when I started working with Tk::Abstract Canvas, this capture does not work properly (both the methods). It mostly captures some partial areas of the AbstractCanvas and not the full.
Is it possible to solve this problem in AbstractCanvas. It would also be great if you can help me getting some other way to capture the canvas in a .jpeg or .tiff or .svg or some format that is more often used (in windows). Presently I am working with Linux but I need to make my code work for windows as well with the capture image of the whole canvas.
Any help would be highly appreciated...Thanks