]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/gdk/pixbuf/ffi/ffi.factor
Merge remote-tracking branch 'Blei/gtk-image-loader'
[factor.git] / basis / gdk / pixbuf / ffi / ffi.factor
index 113cf8d0c860cfae358c600ac9473c490afca31c..2a4f64f042284557ee9e94e9ce5d16f5240bd6d4 100644 (file)
@@ -1,12 +1,12 @@
 ! Copyright (C) 2010 Anton Gorenko.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.libraries alien.syntax combinators
-gobject-introspection kernel system vocabs.loader ;
+USING: alien alien.data alien.libraries alien.syntax
+combinators gio.ffi glib.ffi gmodule.ffi gobject-introspection
+gobject.ffi kernel libc sequences system ;
+EXCLUDE: alien.c-types => pointer ;
 IN: gdk.pixbuf.ffi
 
-<<
 "gio.ffi" require
->>
 
 LIBRARY: gdk.pixbuf
 
@@ -18,3 +18,12 @@ LIBRARY: gdk.pixbuf
 >>
 
 GIR: vocab:gdk/pixbuf/GdkPixbuf-2.0.gir
+
+: data>GInputStream ( data -- GInputStream )
+    [ malloc-byte-array &free ] [ length ] bi
+    f g_memory_input_stream_new_from_data ;
+
+: GInputStream>GdkPixbuf ( GInputStream -- GdkPixbuf )
+    f { { pointer: GError initial: f } }
+    [ gdk_pixbuf_new_from_stream ] with-out-parameters
+    handle-GError ;