Re: How to do a screenshot with PHP-GTK?
| From: | Scott Mattocks | Date: | Wed, 25 Aug 2004 15:05:58 +0000 |
| Subject: | Re: How to do a screenshot with PHP-GTK? | ||
| References: | 1 2 3 4 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5003@lists.php.net to get a copy of this message | ||
Ciprian Popovici wrote:
And on Linux it wouldn't be _that_ simple. First you have to decide if you want to capture the entire screen or a certain window, which has to be identified by its X id. Hopefully you can get that somehow, I seem to recall some gdk function in php-gtk that returned that. Then you have to tell xwd in which file to save the output and you have to convert the xwd format to something usable (png, jpg).Ok so here is some more realistic psuedo code for the linux function function printScreen($widget) { exec('xwd -id ' . $widget->window->xid . ' -out /tmp/temp.img -silent'); my_convert_image_function('/tmp/temp.img/', 'screenshot.jpg'); } The xid is a property of the gdkwindow which is a propetry of all gtkwidgets. Therefore you should be able to capture an image of an individual widget and it's children. Scott Mattocks