Creating a pixmap from PNG data?
- From: Magnus Hacker <mhacker telia com>
- To: gtk-perl-list gnome org
- Subject: Creating a pixmap from PNG data?
- Date: 19 Jun 2002 09:00:28 +0200
(sorry if this appears twice, I had some issues with my mailer..)
Hi,
in my app I use the GD module to create a chart. I can get the chart
as PNG data from the module, and I'd like to put this in a GtkPixmap
widget. However I can't find a function that will create the pixmap
data from PNG data. There are lots of functions to create pixmaps from
files, so currently I use the following ugly workaround:
my $f = "/tmp/$$.png";
open FILE, ">$f";
print FILE $plot->png; # Save PNG data
close FILE;
my $png = Gtk::Gdk::ImlibImage->load_image($f);
unlink $f;
$png->render($w, $h);
$pixmap->set($png->copy_image, $png->copy_mask);
$png->kill_image();
Surely there must be another way to do it? I saw a function called
inlined_png_from_data or something similar in imlib, but it didn't work
when I tried it (got errors about a missing inlined.al in the GtkPerl
installation).
/Hacker
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]