>>>>> "Hugo" == Hugo Schmitt <[email protected]> writes:

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

You may want to use "cleave" here, to get something like (untested):

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

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

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

        [ 50 0 50 50 cairo_rectangle ]
        [ T{ rgba f 0 0 1 0.4 } set-source-color ]
        [ cairo_fill ]
      } cleave
    ] make-png-image drop ;

 Sam
-- 
Samuel Tardieu -- [email protected] -- http://www.rfc1149.net/


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; 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&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to