Re: Problems with Gdk::Pixbuf



Jeremy McLeod <jeremym lawcode net> writes:

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,

replace with :
                $drawable->window,

after making sure drawable has been realized (but it's ok cause you are in a
expose event)


      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.

it says that it wants a Gtk::Gdk::Pixmap :)



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