Re: Gtk2 perl graph saving
- From: "ofey aikon" <ofey aikon gmail com>
- To: gtk-perl-list gnome org
- Subject: Re: Gtk2 perl graph saving
- Date: Sun, 25 Jun 2006 13:28:15 -0500
On 6/24/06, Subhrangshu Supakar <ssupakar gmail com> wrote:
I am a newbie to Gtk2 perl, Iam not being able to save a graph generated by
Gtk2::Ex::Graph::GD.
I can tell you how to save the "image" that is being generated.
The $graph->get_image($data) actually gives you a Gtk2::EventBox with
a Gtk2::Image inside it. I took this approach because I wanted the
graph to respond to 'events' (mouse movements etc) and the Gtk2::Image
itself did not do that.
I think what you can do is as follows.
$graph = Gtk2::Ex::Graph::GD(.......);
# Get the Gtk2::Eventbox out
my $eventbox= $graph->get_image($data);
# Now pull the Gtk2::Image from inside the $eventbox.
my $image = $graph->get_child;
# Now I pull the Gtk2::Gdk::Pixbuf from inside the Gtk2::Image
my $pixbuf = $image->get_pixbuf();
# Now I can write that pixbuf to a file
$pixbuf->save($filename, 'jpeg', quality => '100');
But of course, all this just helps you to save the image alone. Once
you revive the image, you will lose the hotspots in the graph etc.
What are you trying to achieve ? If you can give more insight into
your problem, may be I can help more. Please send me an email off this
list.
Regards,
_Ofey.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]