* Re: Vector Brushes for MetaFun?
2021-09-01 12:06 ` Hans Hagen via ntg-context
@ 2021-09-01 12:52 ` Henning Hraban Ramm via ntg-context
0 siblings, 0 replies; 3+ messages in thread
From: Henning Hraban Ramm via ntg-context @ 2021-09-01 12:52 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Henning Hraban Ramm
[-- Attachment #1: Type: text/plain, Size: 2369 bytes --]
> Am 01.09.2021 um 14:06 schrieb Hans Hagen via ntg-context <ntg-context@ntg.nl>:
>
> 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
[-- Attachment #2: brush-as-pen.svg --]
[-- Type: image/svg+xml, Size: 27561 bytes --]
[-- Attachment #3: brush.mp --]
[-- Type: application/octet-stream, Size: 15046 bytes --]
% Converted from PostScript(TM) to MetaPost by pstoedit
% MetaPost backend contributed by Scott Pakin <scott+ps2ed_AT_pakin.org>
% pstoedit is Copyright (C) 1993 - 2020 Wolfgang Glunz <wglunz35_AT_pstoedit.net>
% Generate structured PostScript
prologues := 1;
% Display a given string with its *baseline* at a given location
% and with a given rotation angle
vardef showtext(expr origin)(expr angle)(expr string) =
draw string infont defaultfont scaled defaultscale
rotated angle shifted origin;
enddef;
beginfig(1);
drawoptions (withcolor (0.137255,0.121569,0.125490));
linecap := butt;
linejoin := mitered;
fill (77.039101,70.000000)..controls (72.601601,69.980499) and (67.457001,69.488297)..(63.382801,69.816399)
..controls (50.871101,68.398399) and (37.566399,69.863297)..(23.792999,69.417999)
..controls (23.257799,68.617203) and (21.355499,69.183601)..(20.195299,69.015602)
..controls (19.878901,68.996101) and (20.035200,68.503899)..(19.593800,68.613297)
..controls (15.402300,68.667999) and (11.496100,67.390602)..(7.996090,67.414101)
..controls (6.472660,66.542999) and (3.828130,66.785202)..(3.000000,65.214798)
..controls (1.906250,65.175797) and (1.222660,64.726601)..(0.402344,64.417999)
..controls (0.367188,63.851601) and (1.074220,64.027298)..(0.796875,63.218800)
..controls (3.277340,63.496101) and (4.511720,62.531300)..(6.597660,62.417999)
..controls (5.910160,62.503899) and (5.476560,62.339802)..(4.996090,62.218800)
..controls (5.156250,61.191399) and (4.351560,61.132801)..(3.597660,61.015598)
..controls (3.742190,60.406300) and (3.394530,60.289101)..(3.398440,59.816399)
..controls (4.363280,60.117199) and (4.234380,59.320301)..(4.199220,58.617199)
..controls (5.070310,58.488300) and (6.457030,58.878899)..(6.996090,58.417999)
..controls (5.968750,57.843800) and (6.921880,57.617199)..(5.800780,57.019501)
..controls (6.292970,57.046902) and (6.769530,57.054699)..(6.796880,56.617199)
..controls (6.628910,56.187500) and (5.523440,56.695301)..(5.398440,56.218800)
..controls (6.390630,56.148399) and (6.761720,55.449200)..(7.199220,54.820301)
..controls (6.570310,54.714802) and (6.425780,54.125000)..(5.800780,54.019501)
..controls (5.550780,53.371101) and (6.445310,53.867199)..(6.199220,53.218800)
..controls (5.765630,52.855499) and (4.960940,52.859402)..(4.597660,52.421902)
..controls (5.804690,51.957001) and (7.363280,52.828098)..(7.996090,51.621101)
..controls (6.605470,51.679699) and (5.929690,51.023399)..(4.597660,51.019501)
..controls (4.335940,50.519501) and (5.531250,50.535198)..(4.796880,50.222698)
..controls (4.421880,50.996101) and (3.625000,49.808601)..(2.398440,50.222698)
..controls (3.375000,48.710899) and (5.144530,50.246101)..(6.796880,49.218800)
..controls (6.683590,48.535198) and (5.898440,48.519501)..(5.800780,47.824200)
..controls (6.300780,48.335899) and (8.792970,49.460899)..(8.996090,47.824200)
..controls (6.890630,47.859402) and (5.750000,46.937500)..(4.199220,46.421902)
..controls (4.140630,46.027302) and (4.468750,46.027302)..(4.597660,45.820301)
..controls (4.242190,45.710899) and (3.769530,45.718800)..(3.597660,45.421902)
..controls (3.785160,45.207001) and (4.335940,45.359402)..(4.199220,44.824200)
..controls (3.820310,44.734402) and (2.996090,45.093800)..(3.199220,44.421902)
..controls (5.445310,44.335899) and (8.312500,44.867199)..(8.996090,43.222698)
--(7.796880,43.222698)..controls (7.488280,42.378899) and (8.910160,43.265598)..(8.597660,42.421902)
..controls (7.011720,42.605499) and (5.468750,41.691399)..(4.796880,41.625000)
..controls (6.527340,41.363300) and (8.183590,42.234402)..(9.597660,41.625000)
..controls (9.101560,41.652302) and (8.769530,41.519501)..(8.597660,41.222698)
..controls (9.035160,40.726601) and (10.726600,41.488300)..(10.796900,40.625000)
..controls (10.105500,40.074200) and (8.820310,40.636700)..(7.996090,40.625000)
..controls (7.601560,40.113300) and (8.207030,39.703098)..(7.796880,39.421902)
..controls (6.613280,39.878899) and (7.074220,38.683601)..(6.398440,38.625000)
..controls (6.101560,38.664101) and (6.214840,39.109402)..(6.199220,39.421902)
..controls (5.593750,38.960899) and (4.574220,38.914101)..(4.199220,38.222698)
..controls (5.171880,37.929699) and (6.187500,37.679699)..(7.597660,37.824200)
..controls (7.554690,37.445301) and (7.824220,37.382801)..(7.796880,37.027302)
..controls (7.457030,36.097698) and (4.847660,36.382801)..(4.796880,35.824200)
..controls (5.820310,36.183601) and (5.601560,35.292999)..(6.199220,35.226601)
..controls (6.539060,35.828098) and (8.136720,36.820301)..(8.796880,35.824200)
..controls (8.441410,35.714802) and (7.964840,35.722698)..(7.796880,35.425800)
..controls (8.726560,35.554699) and (9.328130,35.355499)..(9.199220,34.425800)
..controls (9.804690,34.300800) and (10.918000,34.683601)..(11.195300,34.226601)
..controls (9.015630,33.281300) and (6.218750,32.570301)..(3.796880,33.425800)
..controls (4.191410,33.765598) and (4.996090,33.695301)..(4.996090,34.425800)
..controls (3.851560,34.316399) and (3.632810,34.535198)..(4.199220,35.226601)
..controls (3.003910,35.351601) and (3.093750,34.195301)..(1.800780,34.425800)
..controls (1.554690,33.511700) and (3.152340,34.445301)..(3.199220,33.824200)
..controls (2.539060,32.820301) and (0.453125,33.238300)..(0.000000,32.027302)
..controls (1.011720,31.503901) and (3.210940,32.167999)..(4.199220,31.625000)
..controls (3.882810,30.410200) and (1.050780,31.707001)..(0.796875,30.425800)
..controls (5.503910,30.597700) and (7.777340,28.339800)..(12.394500,28.425800)
..controls (11.156300,26.867201) and (7.277340,27.949200)..(5.398440,27.027300)
..controls (5.187500,26.046900) and (7.457030,26.835899)..(6.597660,25.828100)
..controls (9.652340,26.992201) and (12.968800,25.558599)..(16.195299,25.628901)
..controls (15.949200,24.980499) and (16.843800,25.476601)..(16.593800,24.828100)
--(15.394500,24.828100)..controls (15.148400,24.183599) and (16.042999,24.675800)..(15.796900,24.027300)
..controls (13.019500,24.070299) and (11.089800,23.269501)..(9.199220,22.429701)
..controls (12.242200,22.113300) and (13.679700,23.410200)..(16.593800,23.226601)
..controls (16.628901,23.527300) and (16.523399,23.964800)..(16.792999,24.027300)
..controls (18.644501,24.015600) and (20.742201,24.246099)..(21.593800,23.226601)
..controls (19.238300,23.515600) and (18.609400,22.078100)..(16.195299,22.429701)
..controls (16.632799,21.398399) and (19.234400,22.535200)..(19.992201,21.828100)
..controls (18.730499,21.093800) and (16.417999,21.406300)..(15.394500,20.429701)
..controls (16.824200,20.132799) and (18.445299,20.902300)..(18.593800,19.628901)
..controls (16.902300,20.097700) and (14.734400,19.554701)..(13.796900,18.628901)
..controls (17.027300,18.796900) and (19.136700,17.839800)..(21.992201,17.632799)
..controls (20.468800,17.222700) and (19.300800,16.457001)..(17.195299,16.628901)
..controls (17.277300,14.679700) and (13.750000,16.343800)..(13.195300,15.031300)
..controls (15.179700,14.882800) and (17.824200,15.394500)..(19.195299,14.632800)
..controls (15.921900,13.828100) and (12.113300,14.523400)..(9.597660,13.230500)
..controls (13.449200,13.281300) and (16.316401,12.355500)..(19.992201,12.234400)
..controls (19.621099,11.871100) and (18.601601,12.160200)..(18.796900,11.234400)
..controls (34.074200,10.031300) and (50.203098,10.953100)..(65.781303,10.031300)
..controls (70.847702,9.734380) and (77.347702,8.746090)..(81.777298,8.234380)
..controls (89.457001,7.343750) and (97.562500,6.386720)..(104.570000,5.035160)
..controls (108.948997,4.187500) and (113.862999,1.996090)..(118.566002,2.835940)
--(118.566002,2.035160)..controls (121.289001,0.753906) and (125.730003,0.144531)..(128.964996,0.035156)
..controls (129.343994,1.015630) and (128.296997,0.570313)..(128.363007,1.234380)
..controls (128.988007,1.656250) and (129.535004,1.847660)..(130.960999,1.835940)
..controls (130.621002,2.503910) and (130.945007,2.660160)..(131.363007,3.035160)
..controls (131.832001,2.769530) and (132.272995,2.476560)..(133.160004,2.632810)
..controls (132.292999,3.964840) and (130.664001,4.535160)..(130.160004,6.234380)
..controls (131.272995,5.988280) and (130.824005,7.308590)..(131.761993,7.234380)
..controls (132.007996,7.878910) and (131.113007,7.386720)..(131.363007,8.035160)
--(132.559006,8.035160)..controls (132.391006,9.527340) and (132.511993,10.199200)..(133.160004,11.234400)
..controls (132.617004,11.289100) and (132.690994,11.964800)..(132.160004,12.031300)
..controls (132.309006,12.550800) and (133.113007,12.414100)..(133.160004,13.031300)
..controls (131.604996,13.742200) and (130.375000,14.777300)..(128.964996,15.628900)
..controls (129.246002,16.824200) and (130.367004,15.668000)..(131.363007,15.832000)
..controls (131.382996,16.074200) and (131.421997,16.304701)..(131.761993,16.230499)
..controls (131.979996,17.046900) and (130.535004,16.203100)..(130.960999,17.230499)
..controls (131.604996,17.589800) and (132.190994,18.000000)..(133.363007,17.828100)
..controls (133.608994,18.476601) and (132.714996,17.984400)..(132.960999,18.628901)
..controls (133.354996,18.570299) and (133.358994,18.898399)..(133.563004,19.031300)
..controls (134.479996,19.148399) and (135.098007,18.968800)..(135.563004,18.628901)
..controls (135.593994,19.195299) and (134.882996,19.019501)..(135.160004,19.828100)
..controls (133.382996,20.054701) and (132.718994,21.281300)..(132.363007,22.429701)
--(133.160004,22.429701)..controls (132.839996,23.433599) and (133.727005,23.300800)..(133.563004,24.429701)
..controls (134.059006,24.531300) and (134.770004,24.421900)..(134.761993,25.027300)
..controls (134.526993,25.058599) and (134.195007,24.996099)..(134.160004,25.226601)
..controls (134.781006,25.628901) and (134.184006,26.316401)..(135.160004,27.429701)
..controls (134.141006,27.273399) and (134.145004,28.140600)..(133.761993,28.625000)
..controls (134.401993,28.585899) and (134.625000,28.960899)..(134.761993,29.425800)
..controls (132.636993,30.367201) and (130.522995,31.320299)..(128.761993,32.625000)
..controls (128.843994,33.011700) and (129.679993,32.644501)..(129.363007,33.425800)
..controls (128.414001,33.679699) and (127.848000,34.312500)..(127.362999,35.023399)
..controls (127.487999,35.433601) and (128.371002,35.082001)..(128.160004,35.824200)
..controls (128.003998,36.265598) and (127.223000,36.085899)..(127.164001,36.625000)
..controls (127.285004,37.101601) and (128.035004,36.953098)..(127.762001,37.824200)
..controls (126.808998,37.734402) and (126.055000,37.847698)..(125.964996,38.625000)
..controls (126.433998,38.886700) and (126.871002,39.183601)..(127.762001,39.023399)
..controls (127.851997,40.312500) and (126.253998,39.914101)..(125.964996,40.824200)
..controls (126.015999,41.105499) and (126.402000,41.050800)..(126.563004,41.222698)
..controls (127.012001,41.378899) and (127.198997,40.300800)..(127.563004,41.023399)
..controls (126.777000,41.769501) and (125.723000,42.250000)..(125.164001,43.222698)
..controls (126.402000,42.781300) and (125.523003,44.460899)..(126.762001,44.023399)
..controls (126.503998,44.628899) and (126.280998,45.273399)..(125.563004,45.421902)
..controls (125.390999,46.058601) and (125.737999,46.183601)..(125.964996,46.421902)
..controls (125.144997,47.003899) and (124.835999,48.093800)..(123.960999,48.621101)
..controls (124.773003,48.894501) and (124.598000,48.187500)..(125.164001,48.222698)
..controls (125.105003,49.761700) and (123.323997,49.582001)..(122.563004,50.421902)
..controls (122.585999,50.796902) and (123.226997,50.558601)..(123.164001,51.019501)
..controls (122.464996,51.300800) and (121.883003,50.460899)..(121.566002,51.019501)
..controls (121.566002,51.285198) and (121.914001,51.203098)..(121.964996,51.421902)
..controls (120.878998,51.468800) and (119.789001,51.511700)..(119.765999,52.617199)
..controls (121.237999,52.359402) and (122.265999,51.656300)..(123.566002,51.222698)
..controls (123.601997,52.121101) and (123.938004,52.347698)..(123.164001,52.617199)
..controls (123.660004,52.808601) and (124.366997,51.906300)..(124.362999,52.820301)
..controls (123.655998,53.511700) and (123.164001,54.421902)..(122.366997,55.019501)
..controls (123.148003,55.503899) and (123.198997,56.718800)..(123.566002,57.621101)
..controls (121.976997,59.515598) and (119.042999,60.226601)..(116.366997,60.617199)
..controls (107.160004,61.964802) and (95.664101,62.875000)..(85.972702,64.015602)
..controls (85.593803,64.769501) and (84.675797,64.984398)..(83.976601,65.417999)
..controls (84.011703,65.714798) and (84.457001,65.597702)..(84.773399,65.617203)
..controls (83.925797,66.437500) and (84.785202,67.125000)..(84.773399,68.214798)
..controls (84.093803,69.261703) and (82.562500,69.656303)..(81.175797,69.816399)
..controls (79.921898,69.960899) and (78.519501,70.007797)..(77.039101,70.000000)
--cycle;
fill (6.140630,63.449200)..controls (6.671880,63.457001) and (7.335940,63.335899)..(7.796880,63.417999)
..controls (7.390630,62.957001) and (6.136720,63.343800)..(5.398440,63.218800)
..controls (5.550780,63.390598) and (5.824220,63.441399)..(6.140630,63.449200)
--cycle;
fill (114.737999,49.867199)..controls (116.476997,49.914101) and (117.765999,49.515598)..(118.964996,49.019501)
..controls (119.073997,48.578098) and (118.582001,48.738300)..(118.566002,48.421902)
..controls (118.570000,47.828098) and (120.046997,48.703098)..(119.765999,47.824200)
..controls (117.551003,47.671902) and (116.313004,48.500000)..(114.366997,48.621101)
..controls (114.644997,49.429699) and (113.933998,49.253899)..(113.964996,49.820301)
..controls (114.234001,49.847698) and (114.491997,49.863300)..(114.737999,49.867199)
--cycle;
fill (11.597700,36.824200)..controls (11.726600,35.632801) and (9.808590,36.480499)..(8.996090,36.222698)
..controls (9.597660,37.566399) and (10.832000,35.847698)..(11.597700,36.824200)
--cycle;
fill (17.250000,24.953100)..controls (17.519501,24.960899) and (17.847700,24.695299)..(18.394501,24.828100)
..controls (18.355499,24.496099) and (16.910200,24.023399)..(16.996099,24.828100)
..controls (17.078100,24.917999) and (17.160200,24.949200)..(17.250000,24.953100)
--cycle;
fill (68.472702,23.386700)..controls (69.187500,23.375000) and (69.933601,23.289101)..(70.578102,23.226601)
..controls (71.644501,23.125000) and (72.695297,22.457001)..(73.578102,22.828100)
..controls (71.730499,21.691401) and (67.925797,23.832001)..(65.781303,22.429701)
..controls (66.179703,23.234400) and (67.285202,23.410200)..(68.472702,23.386700)
--cycle;
fill (64.382797,23.226601)--(65.582001,23.226601)--(65.582001,22.828100)
--(64.382797,22.828100)--cycle;
fill (21.359400,16.664101)..controls (21.714800,16.644501) and (22.144501,16.546900)..(22.394501,16.628901)
..controls (22.523399,15.953100) and (21.093800,15.816400)..(20.792999,16.230499)
..controls (20.734400,16.625000) and (21.007799,16.683599)..(21.359400,16.664101)
--cycle;
fill (21.359400,16.664101)--cycle;
endfig;
end
[-- Attachment #4: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread