Ricardo Boccato Alves wrote:

> In order to show how to draw a gadget with a diferent coordinate
> system, I guess It would be nice to abstract the pattern into a word,
>
> something like:
> : with-coords ( gadget x1 y1 x2 y2 quotation -- )
>
>   ... ;
> M: <sine-gadget> draw-gadget* ( SINE -- )
>   -10 10 -10 10
>   [ -10 10 0.5 <range> [ dup sin 2array ] map line-strip ] with-coords ;

Excellent suggestion Ricardo.

I factored out the bulk of the 'draw-gadget*' body from the previous example. 
I called this combinator 'ortho*'.

So the draw-gadget* now looks like this:

M: <sine-gadget> draw-gadget* ( sine -- )
  -10 10 -10 10
    [ -10 10 0.5 <range> [ dup sin 2array ] map line-strip fill-mode ]
  ortho* ;

Besides the added call to 'fill-mode' in the quotation and the name 'ortho*', 
it's identical to the method you posted above.

    http://paste.factorcode.org/paste?id=216

Ed

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to