fixed bugs in cairo, added cairo.samples MAIN: word
parent
dcd07575d0
commit
85d2330289
|
@ -1,8 +1,8 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: cairo kernel accessors sequences
|
USING: cairo.ffi kernel accessors sequences
|
||||||
namespaces fry continuations ;
|
namespaces fry continuations ;
|
||||||
IN: cairo.lib
|
IN: cairo
|
||||||
|
|
||||||
TUPLE: cairo-t alien ;
|
TUPLE: cairo-t alien ;
|
||||||
C: <cairo-t> cairo-t
|
C: <cairo-t> cairo-t
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
USING: system combinators alien alien.syntax kernel
|
USING: system combinators alien alien.syntax kernel
|
||||||
alien.c-types accessors sequences arrays ui.gadgets ;
|
alien.c-types accessors sequences arrays ui.gadgets ;
|
||||||
|
|
||||||
IN: cairo
|
IN: cairo.ffi
|
||||||
<< "cairo" {
|
<< "cairo" {
|
||||||
{ [ os winnt? ] [ "libcairo-2.dll" ] }
|
{ [ os winnt? ] [ "libcairo-2.dll" ] }
|
||||||
{ [ os macosx? ] [ "libcairo.dylib" ] }
|
{ [ os macosx? ] [ "libcairo.dylib" ] }
|
||||||
|
@ -341,24 +341,6 @@ C-STRUCT: cairo_rectangle_t
|
||||||
{ "double" "width" }
|
{ "double" "width" }
|
||||||
{ "double" "height" } ;
|
{ "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
|
C-STRUCT: cairo_rectangle_list_t
|
||||||
{ "cairo_status_t" "status" }
|
{ "cairo_status_t" "status" }
|
||||||
{ "cairo_rectangle_t*" "rectangles" }
|
{ "cairo_rectangle_t*" "rectangles" }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
! Copyright (C) 2008 Matthew Willis.
|
! Copyright (C) 2008 Matthew Willis.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! 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
|
math byte-arrays ui.gadgets accessors arrays
|
||||||
namespaces io.backend ;
|
namespaces io.backend ;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
!
|
!
|
||||||
! these samples are a subset of the samples on
|
! these samples are a subset of the samples on
|
||||||
! http://cairographics.org/samples/
|
! 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 ;
|
io.backend kernel alien.c-types libc namespaces ;
|
||||||
|
|
||||||
IN: cairo.samples
|
IN: cairo.samples
|
||||||
|
@ -138,3 +138,10 @@ IN: cairo.samples
|
||||||
cr 0 128 cairo_move_to
|
cr 0 128 cairo_move_to
|
||||||
cr 256 0 cairo_rel_line_to
|
cr 256 0 cairo_rel_line_to
|
||||||
cr cairo_stroke ;
|
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
|
Loading…
Reference in New Issue