Re: GtkImageView



On 16/12/2007, Torsten Schoenfeld <kaffeetisch gmx de> wrote:
Unfortunately, there's no automatic way to convert raw structs to Perl
land.  In this case, I think the best option would be to represent
GdkPixbufDrawOpts as a hash reference with keys zoom, zoom_rect, etc.
For an example of this kind of thing, take a look at the way
GtkStockItem is handled in Gtk2/xs/GtkStock.xs.

Ah. Thanks! Might I suggest that this and the GdkEvent issue be added
to binding_howto.pod?

Once you have the converter newSVGdkPixbufDrawOpts[1], you can take this
one step further by installing a custom typemap for GdkPixbufDrawOpts:
"GdkPixbufDrawOpts * T_GPERL_GENERIC_WRAPPER" in a typemap file
installed via ExtUtils::Depends->add_typemaps in Makefile.PL -- like

OK. Almost working. As my Perl is much better than my C these days, I
just can't find the correct syntax:

IImageTool.xs: In function `newSVDrawSettings':
IImageTool.xs:33: error: cannot convert to a pointer type
IImageTool.xs: In function `SvDrawSettings':
IImageTool.xs:62: error: incompatible types in assignment

where the relevant lines are:

  hv_store (hv, "zoom_rect", 9, newSVGdkRectangle (settings->zoom_rect), 0);

and

  if (svp) settings->zoom_rect = SvGdkRectangle (*svp);

where

struct DrawSettings {
    gdouble        zoom;
    GdkRectangle   zoom_rect;
    int            widget_x;
    int            widget_y;
    GdkInterpType  interp;
    GdkPixbuf     *pixbuf;
    int            check_color1;
    int            check_color2;
};

and

DrawSettings * settings

in both functions.

I assume that I have an int where I should have a pointer or vice
versa, and made the same mistake in both places.

I'd appreciate a hint!

Thanks

Jeff



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