rearranged cairo: binding in cairo.ffi, high-level words in extra/cairo.
parent
4532810923
commit
dcd07575d0
|
@ -1,7 +0,0 @@
|
|||
USING: cairo math.parser kernel sequences tools.test ;
|
||||
IN: cairo.tests
|
||||
|
||||
[ t ] [ ! apply a little pressure to cairo_version
|
||||
cairo_version number>string CHAR: 0 swap remove
|
||||
CHAR: . cairo_version_string remove =
|
||||
] unit-test
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,36 +0,0 @@
|
|||
! Copyright (C) 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: cairo kernel accessors sequences
|
||||
namespaces fry continuations ;
|
||||
IN: cairo.lib
|
||||
|
||||
TUPLE: cairo-t alien ;
|
||||
C: <cairo-t> cairo-t
|
||||
M: cairo-t dispose ( alien -- ) alien>> cairo_destroy ;
|
||||
|
||||
TUPLE: cairo-surface-t alien ;
|
||||
C: <cairo-surface-t> cairo-surface-t
|
||||
M: cairo-surface-t dispose ( alien -- ) alien>> cairo_surface_destroy ;
|
||||
|
||||
: check-cairo ( cairo_status_t -- )
|
||||
dup CAIRO_STATUS_SUCCESS = [ drop ]
|
||||
[ cairo_status_to_string "Cairo error: " prepend throw ] if ;
|
||||
|
||||
SYMBOL: cairo
|
||||
: cr ( -- cairo ) cairo get ;
|
||||
|
||||
: (with-cairo) ( cairo-t quot -- )
|
||||
>r alien>> cairo r> [ cr cairo_status check-cairo ]
|
||||
compose with-variable ; inline
|
||||
|
||||
: with-cairo ( cairo quot -- )
|
||||
>r <cairo-t> r> [ (with-cairo) ] curry with-disposal ; inline
|
||||
|
||||
: (with-surface) ( cairo-surface-t quot -- )
|
||||
>r alien>> r> [ cairo_surface_status check-cairo ] bi ; inline
|
||||
|
||||
: with-surface ( cairo_surface quot -- )
|
||||
>r <cairo-surface-t> r> [ (with-surface) ] curry with-disposal ; inline
|
||||
|
||||
: with-cairo-from-surface ( cairo_surface quot -- )
|
||||
'[ cairo_create , with-cairo ] with-surface ; inline
|
Loading…
Reference in New Issue