Vector Brushes for MetaFun?
Hi, since Jacob started the pony mode, here’s one I’d like to ride: MetaPost pens are constant, i.e. they never change over the length of a path. Commercial vector graphics apps have “vector brushes”, e.g. Adobe Fresco: https://helpx.adobe.com/fresco/using/vector-brushes.html The page nicely shows the necessary variables. In Inkscape you can combine “brush images” like https://publicdomainvectors.org/en/free-clipart/Paintbrushes-for-Inkscape/86... with pen shapes: https://logosbynick.com/custom-brushes-in-inkscape/ This stretches the whole shape over the path – not perfect but good enough (and the same what e.g. “my” Affinity Designer does). (https://affinity.serif.com/designer/) Is this possible with MetaFun, i.e. use a closed path and distort/stretch it along an open path? If, how? Hraban
On 9/1/2021 12:48 PM, Henning Hraban Ramm via ntg-context wrote:
Hi, since Jacob started the pony mode, here’s one I’d like to ride:
MetaPost pens are constant, i.e. they never change over the length of a path.
Commercial vector graphics apps have “vector brushes”, e.g. Adobe Fresco: https://helpx.adobe.com/fresco/using/vector-brushes.html The page nicely shows the necessary variables.
In Inkscape you can combine “brush images” like https://publicdomainvectors.org/en/free-clipart/Paintbrushes-for-Inkscape/86... with pen shapes: https://logosbynick.com/custom-brushes-in-inkscape/
This stretches the whole shape over the path – not perfect but good enough (and the same what e.g. “my” Affinity Designer does). (https://affinity.serif.com/designer/)
Is this possible with MetaFun, i.e. use a closed path and distort/stretch it along an open path? If, how? you can try to 'reverse engineer the result' and see what is done by looking at the output
anyway, i guess it some mix of existing basics, as in \starttext \startMPcode path p ; p := fullcircle scaled 4cm ; for i=1 upto 10 : nodraw p xscaled (1 randomized .1) yscaled (1 randomized .1) ; endfor ; dodraw p xscaled (1 randomized .1) yscaled (1 randomized .1) withtransparency (1,.5) ; \stopMPcode \startMPcode path p ; p := fullcircle scaled 4cm ; for i=1 upto 10 : draw p xscaled (1 randomized .1) yscaled (1 randomized .1) withtransparency (1,.5) ; endfor ; draw p xscaled (1 randomized .1) yscaled (1 randomized .1) withtransparency (1,.5) ; \stopMPcode \startMPcode path p ; p := ( unitcircle xscaled (5cm randomized 5mm) yscaled (4cm randomized 3mm)) -- (reverse (unitcircle xscaled (5cm randomized 3mm) yscaled (4cm randomized 5mm))) -- cycle; draw (p) % withpattern image (fill fullcircle scaled 2mm withcolor "darkyellow" ;) % withpattern image (draw figure "mill.png" ;) withpattern image (draw figure "hacker.jpg" ;) withpatternscale (1/40,1/80) ; \stopMPcode \stoptext so, fills, eofills, patterns and such Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Am 01.09.2021 um 14:06 schrieb Hans Hagen via ntg-context
: On 9/1/2021 12:48 PM, Henning Hraban Ramm via ntg-context wrote:
Hi, since Jacob started the pony mode, here’s one I’d like to ride: MetaPost pens are constant, i.e. they never change over the length of a path. Commercial vector graphics apps have “vector brushes”, e.g. Adobe Fresco: https://helpx.adobe.com/fresco/using/vector-brushes.html The page nicely shows the necessary variables. In Inkscape you can combine “brush images” like https://publicdomainvectors.org/en/free-clipart/Paintbrushes-for-Inkscape/86... with pen shapes: https://logosbynick.com/custom-brushes-in-inkscape/ This stretches the whole shape over the path – not perfect but good enough (and the same what e.g. “my” Affinity Designer does). (https://affinity.serif.com/designer/) Is this possible with MetaFun, i.e. use a closed path and distort/stretch it along an open path? If, how? you can try to 'reverse engineer the result' and see what is done by looking at the output
The Inkscape SVG just calls a path-effect "bend_path", see attachment. If I save a “normal” SVG, the result is “flattened” into a path that looks the same but isn’t changeable any more.
anyway, i guess it some mix of existing basics, as in
\starttext
\startMPcode path p ; p := ( unitcircle xscaled (5cm randomized 5mm) yscaled (4cm randomized 3mm)) -- (reverse (unitcircle xscaled (5cm randomized 3mm) yscaled (4cm randomized 5mm))) -- cycle; draw (p) % withpattern image (fill fullcircle scaled 2mm withcolor "darkyellow" ;) % withpattern image (draw figure "mill.png" ;) withpattern image (draw figure "hacker.jpg" ;) withpatternscale (1/40,1/80) ;
\stopMPcode
\stoptext
so, fills, eofills, patterns and such
I tried to convert my “brush” into MP, but pstoedit fails on either SVG. It worked via an exported EPS though, see attachment. I could then use the brush as a path, also with "withpattern", but that doesn’t stretch/distort the “pattern” along the path. And I don’t understand how the other fill options would do that. Yes, I must learn more about MetaPost... Hraban
participants (2)
-
Hans Hagen
-
Henning Hraban Ramm