From: Nick N. <nic...@in...> - 2003-01-21 16:55:24
|
Here's my first chs file: ----- module GdkPixbuf (pixbufScaleSimple) where import Foreign import Hierarchy import Object import Monad import UTFCForeign -- @method pixbufScaleSimple@ Create a new GdkPixbuf containing a copy of src scaled to dest_width x dest_height. -- -- * Leaves src unaffected. -- pixbufScaleSimple :: PixbufClass pb => pb -> Int -> Int -> IO pb pixbufScaleSimple pb width height = makeNewObject mkPixbuf $ liftM castPtr $ throwIfNull "GdkPixbuf.pixbufScaleSimple: not enough memory" $ {#call gdk_pixbuf_scale_simple#} (toPixbuf pb) (fromIntegral width) (fromIntegral height) (fromIntegral 0) ----- As you can see, I have no idea about how to bind an enumerated type like typedef enum { GDK_INTERP_NEAREST, GDK_INTERP_TILES, GDK_INTERP_BILINEAR, GDK_INTERP_HYPER } GdkInterpType; which was the last argument of my function (where I shamelessly put (fromIntegral 0)) Apart from this, I get the following error during build: Compiling GdkPixbuf ( gdkPixbuf/GdkPixbuf.hs, gdkPixbuf/GdkPixbuf.o ) ----- gdkPixbuf/GdkPixbuf.hs:19: Couldn't match `Ptr ()' against `Pixbuf' Expected type: Ptr () Inferred type: Pixbuf In the application `toPixbuf pb' In the first argument of `gdk_pixbuf_scale_simple', namely `(toPixbuf pb)' ----- Where am I wrong? Do you see other potential errors in my file? Thanks Vincenzo -- First they ignore you, then they laugh at you, then they fight you, then you win. [Gandhi] |