! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: cairo kernel accessors sequences
+USING: cairo.ffi kernel accessors sequences
namespaces fry continuations ;
-IN: cairo.lib
+IN: cairo
TUPLE: cairo-t alien ;
C: <cairo-t> cairo-t
USING: system combinators alien alien.syntax kernel
alien.c-types accessors sequences arrays ui.gadgets ;
-IN: cairo
+IN: cairo.ffi
<< "cairo" {
{ [ os winnt? ] [ "libcairo-2.dll" ] }
{ [ os macosx? ] [ "libcairo.dylib" ] }
{ "double" "y" }
{ "double" "width" }
{ "double" "height" } ;
-
-: <cairo-rect> ( x y width height -- cairo_rectangle_t )
- "cairo_rectangle_t" <c-object> dup
- {
- [ set-cairo_rectangle_t-height ] [ set-cairo_rectangle_t-width ]
- [ set-cairo_rectangle_t-y ] [ set-cairo_rectangle_t-x ]
- } cleave ;
-
-: rect>cairo ( rect -- cairo_rectangle_t )
- [ loc>> ] [ dim>> ] bi [ [ first ] [ second ] bi ] bi@
- <cairo-rect> ;
-
-: cairo>rect ( cairo_rectangle_t -- rect )
- {
- [ cairo_rectangle_t-x ] [ cairo_rectangle_t-y ]
- [ cairo_rectangle_t-width ] [ cairo_rectangle_t-height ]
- } cleave
- [ 2array ] 2bi@ <rect> ;
C-STRUCT: cairo_rectangle_list_t
{ "cairo_status_t" "status" }
! Copyright (C) 2008 Matthew Willis.
! See http://factorcode.org/license.txt for BSD license.
-USING: cairo cairo.lib ui.render kernel opengl.gl opengl
+USING: cairo cairo.ffi ui.render kernel opengl.gl opengl
math byte-arrays ui.gadgets accessors arrays
namespaces io.backend ;
!
! these samples are a subset of the samples on
! http://cairographics.org/samples/
-USING: cairo cairo.lib locals math.constants math
+USING: cairo cairo.ffi locals math.constants math
io.backend kernel alien.c-types libc namespaces ;
IN: cairo.samples
cr 0 256 cairo_rel_line_to
cr 0 128 cairo_move_to
cr 256 0 cairo_rel_line_to
- cr cairo_stroke ;
\ No newline at end of file
+ cr cairo_stroke ;
+
+ USING: quotations cairo.gadgets ui.gadgets.panes sequences ;
+ : samples ( -- )
+ { arc clip clip-image dash gradient text utf8 }
+ [ 256 256 rot 1quotation <cached-cairo> gadget. ] each ;
+
+ MAIN: samples
\ No newline at end of file