Re: [NTG-context] Vector Brushes for MetaFun?

2021-09-01 Thread Henning Hraban Ramm via ntg-context

> 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/86586.html
>> 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




brush.mp
Description: Binary data
___
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
___


Re: [NTG-context] Vector Brushes for MetaFun?

2021-09-01 Thread 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/86586.html
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
-
___
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
___


[NTG-context] Vector Brushes for MetaFun?

2021-09-01 Thread Henning Hraban Ramm via ntg-context
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/86586.html
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
___
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
___