Re: pictures in php-gtk?
| From: | Gabor Hojtsy | Date: | Mon, 14 Oct 2002 12:56:02 +0000 |
| Subject: | Re: pictures in php-gtk? | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2534@lists.php.net to get a copy of this message | ||
> Question: How do I display pictures in php-gtk? I know it's possible,
> because once I worked out how to do it, but unfortunately I lost the
> code and all I remember is that it was rather difficult and that it
> took hours to figure out how to load and display that picture.
>
> There doesn't seem to be no imlib nor gdk-pixbuf in php-gtk, but there
> are some functions to load .xpm files and some ways to create a
> Gdk::Pixmap with that data.
// Load in the image.
//
// $gdkwindow should be a valid GdkWindow (you can get it
// after you do $appwindow->realize(); on a GtkWindow, and then
// $gdkwindow = $appwindow->window;
// $transcol is a GdkColor instance, or can be null if you would not
// like to have a transparent color, or it's defined in the image
// "image.xpm" is the xpm file
list($pixmap, $mask) = Gdk::pixmap_create_from_xpm(
$gdkwindow,
$transcol,
"image.xpm"
);
// Show the image.
//
// $pixmap and $mask comes from above
// $anycontainer is a container (Vbox, Hbox, etc.)
$image = &new GtkPixmap($pixmap, $mask);
$somecontainer->add($image);
Goba