]> gitweb.factorcode.org Git - factor.git/blob - basis/gdk/pixbuf/ffi/ffi.factor
Merge remote branch 'origin/native-image-loader' into my-gtk
[factor.git] / basis / gdk / pixbuf / ffi / ffi.factor
1 ! Copyright (C) 2009 Anton Gorenko.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien alien.data alien.libraries alien.syntax
4 combinators gio.ffi glib.ffi gmodule.ffi gobject-introspection
5 gobject.ffi kernel libc sequences system ;
6 EXCLUDE: alien.c-types => pointer ;
7 IN: gdk.pixbuf.ffi
8
9 <<
10 "gdk.pixbuf" {
11     { [ os winnt? ] [ "libgdk_pixbuf-2.0-0.dll" cdecl add-library ] }
12     { [ os macosx? ] [ drop ] }
13     { [ os unix? ] [ "libgdk_pixbuf-2.0.so" cdecl add-library ] }
14 } cond
15 >>
16
17 GIR: vocab:gdk/pixbuf/GdkPixbuf-2.0.gir
18
19 : data>GInputStream ( data -- GInputStream )
20     [ malloc-byte-array &free ] [ length ] bi
21     f g_memory_input_stream_new_from_data ;
22
23 : GInputStream>GdkPixbuf ( GInputStream -- GdkPixbuf )
24     f { { pointer: GError initial: f } }
25     [ gdk_pixbuf_new_from_stream ] with-out-parameters
26     handle-GError ;