Re: Gtk::Gdk::Pixmap: load from PNG or JPEG file
- From: Paolo Molaro <lupus ximian com>
- To: gtk-perl-list gnome org
- Subject: Re: Gtk::Gdk::Pixmap: load from PNG or JPEG file
- Date: Mon, 19 Nov 2001 10:39:57 +0100
On 11/19/01 Alvaro del Castillo wrote:
Hi Perl hackers,
I'm using a Gtk::DrawingArea and draw Gtk::Gdk::Pixmaps on it. This
works fine, so far. I initialize the Pixmap from a xpm file.
But xpm is a bad format to work with in real world szenarios, so I want
to load PNG or JPEG files. I checked the Gdk::Imlib reference
documentation and tried this:
I think that Imlib is an obsoleted library. Try GdkPixBuf better.
Well, that doesn't mean it should stop working:-)
my $image = Gtk::Gdk::ImlibImage->load_image ($filename);
my $gdk_pixmap = $image->copy_image;
But $gdk_pixmap is always undef. The same result with
$image->move_image.
You need to render the image to a pixmap before retrieving the pixmap:
$image->render ($image->rgb_width, $image->rgb_height);
$gdk_pixmap = $image->copy_image;
....
You may also use render() to scale the image, just provide the wanted
width and height.
lupus
--
-----------------------------------------------------------------
lupus debian org debian/rules
lupus ximian com Monkeys do it better
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]