Gtk2::Gdk::Pixbuf on win32



Not sure if this is a problem with the gtk2 bindings or the underlying libraries so I figured I'd start here and work my way back. The attached script runs fine on linux. However, I get this on windows:

Couldn't recognize the image file format for file 'image.bmp' at imagetest.pl line 13.

Which is the line: $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file('image.bmp');

On the perl side: Cairo-1.045, Glib 1.164, Gtk2-1.164
Gtk2 libraries: cairo-1.4.14, glib-2.14.6, gtk+-2.12.8

As an aside, in my production script I call something slightly different because the bmp data is already in memory:

$loader = Gtk2::Gdk::PixbufLoader->new;
$loader->write($bmpdata);
$loader->close();
$pixbuf = $loader->get_pixbuf();
$pixbuf->render_to_drawable($fpdraw->window,$fpgc,0,0,0,0,-1,-1,'none',0,0);

But I felt the attached case was more succinct for a demonstration of the same issue.

Any help is much appreciated. Thanks.
T.J.
use Glib qw/TRUE FALSE/;
use Gtk2 '-init';

$mw = Gtk2::Window->new('toplevel');
$mw->signal_connect(destroy => sub { Gtk2->main_quit; });

$fpdraw = Gtk2::DrawingArea->new;
$mw->add($fpdraw);
$fpdraw->realize;
$fpgc = Gtk2::Gdk::GC->new($fpdraw->window);
$fpdraw->signal_connect(expose_event => \&expose_event);

$pixbuf = Gtk2::Gdk::Pixbuf->new_from_file('image.bmp');
$pixbuf->render_to_drawable($fpdraw->window,$fpgc,0,0,0,0,-1,-1,'none',0,0);

$mw->maximize;
$mw->show_all;
Gtk2->main();

sub expose_event
{
        $pixbuf->render_to_drawable($fpdraw->window,$fpgc,0,0,0,0,-1,-1,'none',0,0);
        return FALSE;
}

Windows bitmap



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]