Draw a line with Metafun
Hi, I want to draw a line myself with Metafun. This line should looks like in the module pre-05. I've copied a few lines and try to understand what there happend. But it failed. I've also read in the metafun.pdf, but it ist very hard to understand. I don't see the context between the numbers of x ond y. When I change the numbers the output varies but in no relation to the numbers. Can anyone help to explain this to me or has another documentation? so looks my test: \setupoutput[pdftex] \setupcolors[state=start] \definecolor[back2][r=.6,g=.7,b=.8] \definecolor[back][s=.95] \starttext \startMPinclusions def random_hash_frame (expr width, height, offset, linewidth ) = def delta = ((uniformdeviate .5offset) + .25offset) enddef ; x1 := 0.5cm ; y1 :=0.5cm ; x2 := 16cm ; y2 := 3cm ; drawoptions(withpen pencircle scaled linewidth withcolor \MPcolor{back2}) ; fill z1--(x2,y1)--z2--(x1,y2)--cycle ; enddef; \stopMPinclusions \startuseMPgraphic{jessi} random_hash_frame(height,width, 0.5cm,0.5cm) \stopuseMPgraphic \useMPgraphic{jessi} \stoptext Greetings Jessi
Jessica Holle wrote:
Hi,
I want to draw a line myself with Metafun. This line should looks like in the module pre-05.
I've copied a few lines and try to understand what there happend. But it failed. I've also read in the metafun.pdf, but it ist very hard to understand.
I don't see the context between the numbers of x ond y. When I change the numbers the output varies but in no relation to the numbers.
Can anyone help to explain this to me or has another documentation?
so looks my test:
\setupoutput[pdftex] \setupcolors[state=start] \definecolor[back2][r=.6,g=.7,b=.8] \definecolor[back][s=.95] \starttext \startMPinclusions def random_hash_frame (expr width, height, offset, linewidth ) = def delta = ((uniformdeviate .5offset) + .25offset) enddef ; x1 := 0.5cm ; y1 :=0.5cm ; x2 := 16cm ; y2 := 3cm ; drawoptions(withpen pencircle scaled linewidth withcolor \MPcolor{back2}) ; fill z1--(x2,y1)--z2--(x1,y2)--cycle ; enddef; \stopMPinclusions \startuseMPgraphic{jessi} random_hash_frame(height,width, 0.5cm,0.5cm)
10cm,5cm or whatever, you need to provide some known measures
\stopuseMPgraphic \useMPgraphic{jessi} \stoptext
think of z1 being equivalent to (x1,y1) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Jessica Holle