Re: Inconsistent API for $pixbuf->render_pixmap_and_mask



On Tue, 2002-06-18 at 08:20, Jason Bodnar wrote:
The C API for gdk_pixbuf_render_pixmap_and_mask () is documented as so:

void gdk_pixbuf_render_pixmap_and_mask
                                     (GdkPixbuf *pixbuf,
                                      GdkPixmap **pixmap_return,
                                      GdkBitmap **mask_return,
                                      int alpha_threshold);

but the Perl API says the function is defined as:

$pixbuf->render_pixmap_and_mask($alpha_threshold);

Is the Perl version missing some parameters or does it return the pixmap and
mask as a list from the function?

--
Jason Bodnar
jason shakabuku org
http://www.shakabuku.org

No, it is just designed to be more Perlish.  The API should say:

($pixmap, $mask) = $pixbuf->render_pixmap_and_mask($alpha_threshold);

Gtk/Gdk/Gnome are all coded in C.  The first argument to the C function
is the "object" (C is not an OO language) you are working with.  Perl
has the ability to create objects, so they wrapped this function (and,
if you look carefully, almost all functions) up with OO syntax ($pixbuf
is GdkPixbuf *pixbuf).  Also, in C you can only have one variable in the
return.  So they use pointers to implement a Pass-By-Reference scheme
(GdkPixmap **pixmap_return and GdkBitmap **mask_return).  This is
unnecessary in Perl since it supports multiple return variables.

Hope this helps.
   
-- 
Today is Prickle-Prickle the 23rd day of Confusion in the YOLD 3168
Pzat!

Missile Address: 33:48:3.521N  84:23:34.786W




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