Re: Display an image
| From: | Markus Fischer | Date: | Sat, 06 Oct 2001 10:25:08 +0000 |
| Subject: | Re: Display an image | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-210@lists.php.net to get a copy of this message | ||
First, you only need GtkImage if you want to manipulate its
contents. If you just want to dislpay an image, use GtkPixmap.
Only *.XPM graphics file format is supported right now but
support for gdb-pixbuf (== laod more different image formats than
just XPM) will be added.
If you want to load your XPM image data straigt from a file you
can use pixmap_create_from_xom:
list($pixmap, $bitmap) = Gdk::pixmap_create_from_xpm($widget->window, NULL,
'filename');
The first parameter to pixmap..from_xpm() is the associated
GdkWindow where to draw the GdkPixmap into. It is needed and may
not be available if you just created the widget you want to put
the GtkPixmap into. Therefore you can force the widget to
realize() itself and get an associated drawing area:
$widget->realize(); // before you use pixmap..from_xpm()
Alternatively you can define an array with the XPM image data
right in the source code and generate the necessary data from it.
This is well used in many different places in the gtk.php files
coming with php-gtk in the test/ directory.
HTH,
- Markus
On Sat, Oct 06, 2001 at 11:20:03AM +0200, Beethoven II wrote :
> Hello to everyone:
> I'd like to display an image on a gtk window:
> So i have to use GtkImage but what metthods i have to apply on it?
> Thanks
--
Markus Fischer, http://guru.josefine.at/~mfischer/
EMail: mfischer@guru.josefine.at
PGP Public Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0
-All your scripts are belong to Zend-