Re: Howto for Pixmaps?
| From: | firepages.com.au | Date: | Tue, 07 Jan 2003 09:22:53 +0000 |
| Subject: | Re: Howto for Pixmaps? | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2849@lists.php.net to get a copy of this message | ||
Hi, win32 or *nix? ... I use imagemagick (http://www.imagemagick.org) to
create pixmaps from image.$extension , its a command line tool but easy to
use .. there are some GUI's as well (PMview is worth a google) , I have a
directory coverter script somewhere I will try and dig it up
(PHP/imagemagick)
imagemagick at a command prompt....
cd image_magick
convert /path/to/images/this.jpg /path/to/images/that.xpm
(or via PHP... <? exec("path_to/imagic/convert /path/to/images/this.jpg
/path/to/images/that.xpm");?>
to load a pixmap from file and display...
<?
(strtoupper(substr(PHP_OS, 0, 3)) ==
'WIN')?dl('php_gtk.dll'):dl('php_gtk.so');
$win = &new GtkWindow();
$win->connect('delete_event', create_function('',
'Gtk::main_quit();'));
$win->realize();
/*load pixmap*/
list($pixmap, $mask) =
Gdk::pixmap_create_from_xpm($win->window,null,'/path/to/your/image.xpm');
$image = &new GtkPixmap($pixmap, $mask);
/*container to stick the image in*/
$box = &new GtkVbox();
/*add the image to the box*/
$box->add($image);
/*etc*/
$win->add($box);
$win->show_all();
Gtk::main();
?>
Regards,
Simon.
----- Original Message -----
From: "Benjamin Smith" <bens@effortlessis.com>
To: <php-gtk-general@lists.php.net>
Sent: Tuesday, January 07, 2003 12:15 PM
Subject: [PHP-GTK] Howto for Pixmaps?
> I just can't seem to figure this out. =/
>
> I'm starting with an image on the disk, logo.bmp, 50x50 px.
>
> How would I turn this into a gdk pixmap, and how would I use gtkPixmap()
to
> display it?
>
> A few sample lines of code would make things so much clearer...
>
> Thanks,
>
> -Ben
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>