Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Problem with postscript capturing of Tk::AbstractCanvas

by KuntalBhusan (Acolyte)
on Nov 29, 2012 at 15:11 UTC ( #1006267=perlquestion: print w/replies, xml ) Need Help??
KuntalBhusan has asked for the wisdom of the Perl Monks concerning the following question:

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

Replies are listed 'Best First'.
Re: Problem with postscript capturing of Tk::AbstractCanvas
by Anonymous Monk on Nov 29, 2012 at 15:31 UTC
    Ha! ha! this works for me  qw/ -x -1200 -y -1200 -width 2400 -height 2400 /,

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1006267]
Approved by Old_Gray_Bear
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2017-06-25 18:41 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (568 votes). Check out past polls.