Re: Adding the gdk-pixbuf canvas object to the canvas



On 10/16/01 Dov Grobgeld wrote:
I tried to add the gdk-pixbuf canvas object so that it works
with GtkPerl. Compilation works, but when I try to use it
in the following code:

    my $img = new_from_file Gtk::Gdk::Pixbuf("save.png");
    my $imgitem = $cgroup2->new($cgroup2, "Gnome::CanvasPixbuf",
          'pixbuf' => $line,
          'x' => 50,
          'y' => 50,
          );

I get the error message:
 
    Cannot set argument of type gpointer (fundamental type gpointer)
    at ./canvas-pixbuf.pl line 126.
    
Does someone have any idea of what I forget? 

The 'pixbuf' property of Gnome::CanvasPixbuf is registered as
GTK_TYPE_POINTER, so the perl binding can't use it in a safe way.
You may want to do something like the code in
Gnome/xs/GnomeCanvasItem.xs (the PerlGtkTypeHelper struct and the call
to AddTypeHelper): when the argument type is GTK_TYPE_POINTER, you
assume it's a pixbuf that you need to store/retrieve. You can also check
that arg->name is "pixbuf" so that the guess is more reliable.

lupus

-- 
-----------------------------------------------------------------
lupus debian org                                     debian/rules
lupus ximian com                             Monkeys do it better



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