]> gitweb.factorcode.org Git - factor.git/commitdiff
fixed bugs in cairo, added cairo.samples MAIN: word
authorMatthew Willis <matthew.willis@mac.com>
Mon, 12 May 2008 03:51:33 +0000 (20:51 -0700)
committerMatthew Willis <matthew.willis@mac.com>
Mon, 12 May 2008 03:51:33 +0000 (20:51 -0700)
extra/cairo/cairo.factor
extra/cairo/ffi/ffi.factor
extra/cairo/gadgets/gadgets.factor
extra/cairo/samples/samples.factor

index c9700e82c0769b6ee5486dfba2b3586fde65626a..077152a3c20333ef34ccc678dbca59a609a1c8d8 100755 (executable)
@@ -1,8 +1,8 @@
 ! 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
index b82191f72cc389776cda4841f175e900401d4c60..451806c0a74c53aa797dc3ede4fd27a7b9a2dfc8 100644 (file)
@@ -7,7 +7,7 @@
 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" ] }
@@ -340,24 +340,6 @@ C-STRUCT: cairo_rectangle_t
     { "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" }
index 98b3c452eb73145f7d730172899eb62cf06d2b26..e0daefd63c80d1060837f0fe82dc62e4a1cbf367 100644 (file)
@@ -1,6 +1,6 @@
 ! 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 ;
 
index 2d8d34a376a41dc0f69afbf4669c2fce4358ab92..402c3881f4399248ce3432e47995103015e4a395 100644 (file)
@@ -3,7 +3,7 @@
 !
 ! 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
@@ -137,4 +137,11 @@ 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