Re: PHP-GTK2 : Problem with draw_pixbuf within a GtkDrawingArea
| From: | Anant Narayanan | Date: | Wed, 11 Jan 2006 10:14:36 +0000 |
| Subject: | Re: PHP-GTK2 : Problem with draw_pixbuf within a GtkDrawingArea | ||
| References: | 1 2 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-2179@lists.php.net to get a copy of this message | ||
Oops! Forgot the program...
Also, the error doesnt occur when the
connect('expose_event'...)
is commented out...
<?php
error_reporting(E_ALL);
$image_file = "C:\\images\\pic00041.jpg";
$window = new GtkWindow();
$window->set_border_width(5);
$window->set_title('GdkPixbuf example');
$window->set_resizable(false);
$window->connect_object('destroy', array('gtk', 'main_quit'));
try {
$pixbuf = GdkPixbuf::new_from_file($image_file);
} catch (PhpGtkGErrorException $e) {
die($e->message . "\n");
}
$area = new GtkDrawingArea();
$area->set_size_request($pixbuf->get_width(), $pixbuf->get_height());
$frame = new GtkFrame();
$frame->add($area);
$frame->set_shadow_type(Gtk::SHADOW_IN);
$window->add($frame);
$area->connect('expose_event', 'expose_event', $pixbuf);
$window->show_all();
gtk::main();
function expose_event($area, $event, $pixbuf)
{
$area->window->draw_pixbuf($area->style->fg_gc[Gtk::STATE_NORMAL],
$pixbuf,$event->area->x, $event->area->y,
$event->area->x, $event->area->y);
}
?>
Regards
--
Anant Narayanan
-------------------------
Find Freedom!
http://www.kix.in/