1 ! Copyright (C) 2010 Anton Gorenko.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien alien.c-types alien.data alien.libraries
4 alien.syntax combinators gio.ffi glib.ffi gobject-introspection
5 gobject-introspection.standard-types kernel libc sequences
9 << "gio.ffi" require >>
14 { [ os windows? ] [ "libgdk_pixbuf-2.0-0.dll" ] }
15 { [ os macosx? ] [ "libgdk_pixbuf-2.0.dylib" ] }
16 { [ os unix? ] [ "libgdk_pixbuf-2.0.so" ] }
17 } cond cdecl add-library >>
19 GIR: vocab:gdk/pixbuf/GdkPixbuf-2.0.gir
21 ! <workaround incorrect return-values in gir
23 FORGET: gdk_pixbuf_get_pixels
24 FUNCTION: guint8* gdk_pixbuf_get_pixels ( GdkPixbuf* pixbuf )
26 FORGET: gdk_pixbuf_new_from_data
27 FUNCTION: GdkPixbuf* gdk_pixbuf_new_from_data ( guint8* data,
28 GdkColorspace colorspace,
34 GdkPixbufDestroyNotify destroy_fn,
35 gpointer destroy_fn_data )
37 FORGET: gdk_pixbuf_save_to_bufferv
38 FUNCTION: gboolean gdk_pixbuf_save_to_bufferv ( GdkPixbuf* pixbuf,
49 : data>GInputStream ( data -- GInputStream )
50 [ malloc-byte-array &free ] [ length ] bi
51 f g_memory_input_stream_new_from_data ;
53 : GInputStream>GdkPixbuf ( GInputStream -- GdkPixbuf )
54 f { { pointer: GError initial: f } }
55 [ gdk_pixbuf_new_from_stream ] with-out-parameters