Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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

Comment on Problem with postscript capturing of Tk::AbstractCanvas
Select or Download Code
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1006267]
Approved by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2014-12-25 11:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (160 votes), past polls