]> gitweb.factorcode.org Git - factor.git/blob - basis/gdk/pixbuf/ffi/ffi.factor
Merge remote-tracking branch 'Blei/gtk-image-loader'
[factor.git] / basis / gdk / pixbuf / ffi / ffi.factor
1 ! Copyright (C) 2010 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 "gio.ffi" require
10
11 LIBRARY: gdk.pixbuf
12
13 <<
14 "gdk.pixbuf" {
15     { [ os winnt? ] [ "libgdk_pixbuf-2.0-0.dll" cdecl add-library ] }
16     { [ os unix? ] [ drop ] }
17 } cond
18 >>
19
20 GIR: vocab:gdk/pixbuf/GdkPixbuf-2.0.gir
21
22 : data>GInputStream ( data -- GInputStream )
23     [ malloc-byte-array &free ] [ length ] bi
24     f g_memory_input_stream_new_from_data ;
25
26 : GInputStream>GdkPixbuf ( GInputStream -- GdkPixbuf )
27     f { { pointer: GError initial: f } }
28     [ gdk_pixbuf_new_from_stream ] with-out-parameters
29     handle-GError ;