]> gitweb.factorcode.org Git - factor.git/blob - basis/gdk/pixbuf/ffi/ffi.factor
Remove Windows CE from core/ basis/ and build-support/
[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 gobject-introspection
5 gobject-introspection.standard-types kernel libc
6 sequences system vocabs.loader ;
7 IN: gdk.pixbuf.ffi
8
9 <<
10 "gio.ffi" require
11 >>
12
13 LIBRARY: gdk.pixbuf
14
15 <<
16 "gdk.pixbuf" {
17     { [ os windows? ] [ "libgdk_pixbuf-2.0-0.dll" cdecl add-library ] }
18     { [ os unix? ] [ drop ] }
19 } cond
20 >>
21
22 GIR: vocab:gdk/pixbuf/GdkPixbuf-2.0.gir
23
24 ! <workaround incorrect return-value in gir
25
26 FORGET: gdk_pixbuf_get_pixels
27 FUNCTION: guint8* gdk_pixbuf_get_pixels ( GdkPixbuf* pixbuf ) ;
28
29 ! workaround>
30
31 : data>GInputStream ( data -- GInputStream )
32     [ malloc-byte-array &free ] [ length ] bi
33     f g_memory_input_stream_new_from_data ;
34
35 : GInputStream>GdkPixbuf ( GInputStream -- GdkPixbuf )
36     f { { pointer: GError initial: f } }
37     [ gdk_pixbuf_new_from_stream ] with-out-parameters
38     handle-GError ;