Hi again,

what would be the best way to reorganize code like this (most Cairo
functions take the same first argument):

: hello-cairo ( -- )
    { 100 100 }
    [
        [ T{ rgba f 0 0 0 1 } set-source-color ] keep
        [ 0 0     cairo_move_to ] keep
        [ 100 100 cairo_line_to ] keep
        [ 100 0   cairo_move_to ] keep
        [ 0 100   cairo_line_to ] keep
        [ 20      cairo_set_line_width ] keep
        [ cairo_stroke ] keep

        [ 0 0 50 50 cairo_rectangle ] keep
        [ T{ rgba f 1 0 0 0.8 } set-source-color ] keep
        [ cairo_fill ] keep

        [ 0 50 50 50 cairo_rectangle ] keep
        [ T{ rgba f 0 1 0 0.6 } set-source-color ] keep
        [ cairo_fill ] keep

        [ 50 0 50 50 cairo_rectangle ] keep
        [ T{ rgba f 0 0 1 0.4 } set-source-color ] keep
        [ cairo_fill ] keep

        drop
    ] make-png-image drop ;

to remove all the "keep"s?

TIA,
Hugo

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to