> Am 11.05.2021 um 18:02 schrieb Aditya Mahajan <adit...@umich.edu>:
> 
> Look at this old code on how hide such code behind a macro to have a clean 
> interface:
> 
> https://github.com/adityam/mp-sketch/blob/master/mp-sketch.mp

Hi Aditya,
I’m trying to include my additions into your code, but it doesn’t work.


numeric sketch_amount; sketch_amount := 3bp;
numeric sketch_passes; sketch_passes := 5;

def sketchdraw expr p =
  do_sketchdraw(p if (path p): randomized sketch_amount fi)
enddef;

def do_sketchdraw(expr p) text t =
    normaldraw p t ;
enddef;


Now I want to draw that path several times.

If I understand it right, I can’t put that into "sketchdraw" because that 
leaves the end open for path additions like "withcolor".

But it also doesn’t work in "do_sketchdraw"; I thought it might like this:

def do_sketchdraw(expr p) text t =
    for i=0 upto sketch_passes :
      normaldraw p t ; 
        % withtransparency ("multiply", 1/sketch_passes) ; % and how can I add 
that without breaking other additions?
    endfor
enddef;

But that just blocks, I guess there’s an infinite loop.

I’d be happy about some advise.

Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to