Re: Gtk2::Image Loading a png from scalar
- From: Dov Grobgeld <dov grobgeld weizmann ac il>
- To: carls107 msu edu
- Cc: gtk-perl-list gnome org
- Subject: Re: Gtk2::Image Loading a png from scalar
- Date: Wed, 4 Aug 2004 15:17:51 IDT
If these libraries can create uncompressed image data, then you can
create an image without going to disk through the
Gtk2::Gdk::Pixbuf->new_from_data function. I'm using it e.g. to
directly display piddles (Perl Data Language structures). Here
is what I do:
my($w,$h) = ($rgb->dims)[1,2];
$rgb->make_physical;
my $img = Gtk2::Gdk::Pixbuf->new_from_data(${$rgb->get_dataref},
"rgb",
0, 8,
$w,$h, $w*3);
The $rgb->get_dataref call returns (a reference to) a scalar
containing the RGB values.
The pixbuf is then easily placed in an Gtk::Image .
There doesn't seem to be a way of doing the same with compressed
png data though...
Regards,
Dov
On Tue, Aug 03, 2004 at 12:13:39PM -0400, William B Carlson wrote:
I have a library (GD::Graph, GD::Dashboard, etc) that can create an image
and put it in scalar reference. It can also make a physical file on the
file system which I can load in with
Gtk2::Image->new_from_file("file.png").
What I want to know is if there is a way to take the scalar
( my $image = $dash->png() ) that the library can produce and load that
into the application without having to write the file to the file system
and read it again.
Thanks for your time,
Ben Carlson
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]