Problems with Gdk::Pixbuf



Hi,

I'm trying to load png data from a GD::Image object into a DrawingArea,
but I'm having problems.  This is the relevant code:

-----
my $gd = $graph->plot(\ data);
...
my $drawable = new Gtk::DrawingArea();
$drawable->size(500,200);
$window->add($drawable);

my $pixbuf = new_from_data Gtk::Gdk::Pixbuf(
        $gd->png,
        $colorspace,
        $true,
        $bits,
        $width,
        $height,
        $rowstride,
);
$drawable->signal_connect('expose_event', sub {
    $pixbuf->render_to_drawable_alpha(
                $drawable,
        0, 0, 0, 0,
        $pixbuf->get_width(), $pixbuf->get_height(),
        0, 50, 0, 0, 0);
    1;
});
-----

But when I run it, I get this error:

variable is not of type Gtk::Gdk::Pixmap at test.pl line 68.

Line 68 is the '$pixbuf->render_to_drawable_alpha(...' line, so I'm
assuming it means there's something leftass with $pixbuf.

What's the problem, here?  I've tried with both $gd and $graph as the
data for new_from_data as well; all spit out the same error.

If more details are needed I'd be happy to provide them.

-- 
Jeremy McLeod
jeremym lawcode net



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