* Best way to apply a fill-pattern to a closed shape?
@ 2021-08-28 9:33 Ramkumar KB via ntg-context
2021-08-28 11:02 ` Hans Hagen via ntg-context
0 siblings, 1 reply; 6+ messages in thread
From: Ramkumar KB via ntg-context @ 2021-08-28 9:33 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Ramkumar KB
[-- Attachment #1.1: Type: text/plain, Size: 478 bytes --]
Hello List,
I have a use case to apply a particular pattern to a closed shape. I am
using Metapost for the figures.
After some research this package seems to quite good, in terms of having
all the patterns normally used - https://ctan.org/pkg/minim-hatching
But I could not figure out how to use this with ConTeXt. Or maybe there is
already a better way to do this in ConTeXt and am missing that trick.
Any tips would be really helpful.
Thank you.
Best regards,
Ramkumar
[-- Attachment #1.2: Type: text/html, Size: 735 bytes --]
[-- Attachment #2: 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] 6+ messages in thread
* Re: Best way to apply a fill-pattern to a closed shape?
2021-08-28 9:33 Best way to apply a fill-pattern to a closed shape? Ramkumar KB via ntg-context
@ 2021-08-28 11:02 ` Hans Hagen via ntg-context
2021-08-29 2:48 ` Ramkumar KB via ntg-context
0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen via ntg-context @ 2021-08-28 11:02 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Hans Hagen
On 8/28/2021 11:33 AM, Ramkumar KB via ntg-context wrote:
> Hello List,
>
> I have a use case to apply a particular pattern to a closed shape. I am
> using Metapost for the figures.
>
> After some research this package seems to quite good, in terms of having
> all the patterns normally used - https://ctan.org/pkg/minim-hatching
> <https://ctan.org/pkg/minim-hatching>
>
> But I could not figure out how to use this with ConTeXt. Or maybe there
> is already a better way to do this in ConTeXt and am missing that trick.
>
> Any tips would be really helpful.
\starttext
\startMPpage[offset=1cm]
draw (fullcircle scaled 5cm shifted (0cm,0cm))
withpattern image (fill fullcircle scaled 1cm withcolor
"darkblue" ;)
withpatternscale (1/10,1/10)
;
draw (fullcircle scaled 5cm shifted (5cm,0cm))
withpattern image (fill fullcircle scaled 5mm withcolor
"darkred" ;)
withpatternscale (1/20,1/20)
;
draw (fullcircle scaled 5cm shifted (10cm,0cm))
withpattern image (fill fullcircle scaled 5mm withcolor
"darkgreen" ;)
withpatternscale (1/40,1/40)
;
draw (fullcircle scaled 5cm shifted (0cm,5cm))
withpattern image (fill fullcircle scaled 1cm withcolor
"darkcyan" ;)
withpatternscale (1/10,1/20)
;
draw (fullcircle scaled 5cm shifted (5cm,5cm))
withpattern image (fill fullcircle scaled 5mm withcolor
"darkmagenta" ;)
withpatternscale (1/20,1/40)
;
draw (fullcircle scaled 5cm shifted (10cm,5cm))
withpattern image (fill fullcircle scaled 5mm withcolor
"darkyellow" ;)
withpatternscale (1/40,1/80)
;
\stopMPpage
\startMPpage[offset=1cm]
fill fullcircle scaled 11cm
withcolor "darkyellow" ;
draw fullcircle scaled 10cm
withpattern image (fill fullcircle scaled 1cm withcolor
"darkblue" ;)
;
draw fulldiamond scaled 8cm
withpattern image (fill fulldiamond scaled 4mm withcolor
"darkgreen" ;)
rotated 15
;
draw fulltriangle scaled 9cm
withpattern image (fill fulltriangle scaled 3mm withcolor
"white" ;)
rotated 45
;
draw fullcircle scaled 10cm
withpattern image (draw textext("!") withcolor "middlegray" ;)
rotated 45
;
draw fullcircle scaled 10cm
withpen pencircle scaled 1mm
withcolor "darkgray" ;
\stopMPpage
\startMPpage[instance=doublefun]
fill fullcircle scaled 8cm withcolor "yellow" ;
draw fullcircle scaled 8cm
withpattern image (draw figure("t:/sources/cow.pdf") rotated 45;)
withpatternscale 1/40
;
\stopMPpage
\startMPpage[instance=doublefun]
draw closedcurve(unitsquare xyscaled (200,200) shifted (0,-200))
withpattern image (fill closedcurve((fullcircle scaled 40
shifted (25,-25))) withcolor "darkgray" withopacity .5)
withpatternscale (1,1)
;
draw closedcurve(unitsquare xyscaled (200,200) shifted (0,-200))
withpattern image (fill closedcurve((fullcircle scaled 40
shifted (25,-25))) withcolor "darkred" withopacity .5)
withpatternscale (1/2,1/2)
;
draw closedcurve(unitsquare xyscaled (200,200) shifted (0,-200))
withpattern image (fill closedcurve((fullcircle scaled 40
shifted (25,-25))) withcolor "darkgreen" withopacity .5)
withpatternscale (1/3,1/3)
;
draw closedcurve(unitsquare xyscaled (200,200) shifted (0,-200))
withpattern image (fill closedcurve((fullcircle scaled 40
shifted (25,-25))) withcolor "darkblue" withopacity .5)
withpatternscale (1/4,1/4)
;
\stopMPpage
% \startTEXpage
\page
\startMPcode{doublefun}
draw closedcurve(unitsquare xyscaled (200,200) shifted (0,-400))
withpattern image (fill closedcurve((fullcircle scaled 40
shifted (25,-25))))
withpatternscale 1/8
;
\stopMPcode
\blank
\startMPcode{doublefun}
draw closedcurve(unitsquare xyscaled (200,200) shifted (0,-400))
withpattern image (fill closedcurve((fullcircle scaled 40
shifted (25,-25))))
withpatternfloat true
withpatternscale 1/8
;
\stopMPcode
\page
% \stopTEXpage
\stoptext
-----------------------------------------------------------------
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Best way to apply a fill-pattern to a closed shape?
2021-08-28 11:02 ` Hans Hagen via ntg-context
@ 2021-08-29 2:48 ` Ramkumar KB via ntg-context
2021-08-29 9:17 ` Hans Hagen via ntg-context
0 siblings, 1 reply; 6+ messages in thread
From: Ramkumar KB via ntg-context @ 2021-08-29 2:48 UTC (permalink / raw)
To: Hans Hagen; +Cc: Ramkumar KB, mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 5326 bytes --]
Hans,
Thank you for the snippets. These are super helpful (I am assuming commands
like `withpatternscale` are MetaFun extensions and Wow!).
I have added them to a new Wiki Page -
https://wiki.contextgarden.net/Fill_Patterns and linked it the main MetaFun
wiki page - https://wiki.contextgarden.net/MetaFun_-_MetaPost_in_ConTeXt
Thanks again!
best regards,
Ramkumar
On Sat, Aug 28, 2021 at 7:02 PM Hans Hagen <j.hagen@xs4all.nl> wrote:
> On 8/28/2021 11:33 AM, Ramkumar KB via ntg-context wrote:
> > Hello List,
> >
> > I have a use case to apply a particular pattern to a closed shape. I am
> > using Metapost for the figures.
> >
> > After some research this package seems to quite good, in terms of having
> > all the patterns normally used - https://ctan.org/pkg/minim-hatching
> > <https://ctan.org/pkg/minim-hatching>
> >
> > But I could not figure out how to use this with ConTeXt. Or maybe there
> > is already a better way to do this in ConTeXt and am missing that trick.
> >
> > Any tips would be really helpful.
> \starttext
>
> \startMPpage[offset=1cm]
> draw (fullcircle scaled 5cm shifted (0cm,0cm))
> withpattern image (fill fullcircle scaled 1cm withcolor
> "darkblue" ;)
> withpatternscale (1/10,1/10)
> ;
>
> draw (fullcircle scaled 5cm shifted (5cm,0cm))
> withpattern image (fill fullcircle scaled 5mm withcolor
> "darkred" ;)
> withpatternscale (1/20,1/20)
> ;
>
> draw (fullcircle scaled 5cm shifted (10cm,0cm))
> withpattern image (fill fullcircle scaled 5mm withcolor
> "darkgreen" ;)
> withpatternscale (1/40,1/40)
> ;
>
> draw (fullcircle scaled 5cm shifted (0cm,5cm))
> withpattern image (fill fullcircle scaled 1cm withcolor
> "darkcyan" ;)
> withpatternscale (1/10,1/20)
> ;
>
> draw (fullcircle scaled 5cm shifted (5cm,5cm))
> withpattern image (fill fullcircle scaled 5mm withcolor
> "darkmagenta" ;)
> withpatternscale (1/20,1/40)
> ;
>
> draw (fullcircle scaled 5cm shifted (10cm,5cm))
> withpattern image (fill fullcircle scaled 5mm withcolor
> "darkyellow" ;)
> withpatternscale (1/40,1/80)
> ;
> \stopMPpage
>
> \startMPpage[offset=1cm]
> fill fullcircle scaled 11cm
> withcolor "darkyellow" ;
>
> draw fullcircle scaled 10cm
> withpattern image (fill fullcircle scaled 1cm withcolor
> "darkblue" ;)
> ;
>
> draw fulldiamond scaled 8cm
> withpattern image (fill fulldiamond scaled 4mm withcolor
> "darkgreen" ;)
> rotated 15
> ;
>
> draw fulltriangle scaled 9cm
> withpattern image (fill fulltriangle scaled 3mm withcolor
> "white" ;)
> rotated 45
> ;
>
> draw fullcircle scaled 10cm
> withpattern image (draw textext("!") withcolor "middlegray" ;)
> rotated 45
> ;
>
> draw fullcircle scaled 10cm
> withpen pencircle scaled 1mm
> withcolor "darkgray" ;
> \stopMPpage
>
> \startMPpage[instance=doublefun]
> fill fullcircle scaled 8cm withcolor "yellow" ;
> draw fullcircle scaled 8cm
> withpattern image (draw figure("t:/sources/cow.pdf") rotated 45;)
> withpatternscale 1/40
> ;
> \stopMPpage
>
>
> \startMPpage[instance=doublefun]
> draw closedcurve(unitsquare xyscaled (200,200) shifted (0,-200))
> withpattern image (fill closedcurve((fullcircle scaled 40
> shifted (25,-25))) withcolor "darkgray" withopacity .5)
> withpatternscale (1,1)
> ;
> draw closedcurve(unitsquare xyscaled (200,200) shifted (0,-200))
> withpattern image (fill closedcurve((fullcircle scaled 40
> shifted (25,-25))) withcolor "darkred" withopacity .5)
> withpatternscale (1/2,1/2)
> ;
> draw closedcurve(unitsquare xyscaled (200,200) shifted (0,-200))
> withpattern image (fill closedcurve((fullcircle scaled 40
> shifted (25,-25))) withcolor "darkgreen" withopacity .5)
> withpatternscale (1/3,1/3)
> ;
> draw closedcurve(unitsquare xyscaled (200,200) shifted (0,-200))
> withpattern image (fill closedcurve((fullcircle scaled 40
> shifted (25,-25))) withcolor "darkblue" withopacity .5)
> withpatternscale (1/4,1/4)
> ;
> \stopMPpage
>
> % \startTEXpage
> \page
> \startMPcode{doublefun}
> draw closedcurve(unitsquare xyscaled (200,200) shifted (0,-400))
> withpattern image (fill closedcurve((fullcircle scaled 40
> shifted (25,-25))))
> withpatternscale 1/8
> ;
> \stopMPcode
> \blank
> \startMPcode{doublefun}
> draw closedcurve(unitsquare xyscaled (200,200) shifted (0,-400))
> withpattern image (fill closedcurve((fullcircle scaled 40
> shifted (25,-25))))
> withpatternfloat true
> withpatternscale 1/8
> ;
> \stopMPcode
> \page
> % \stopTEXpage
>
> \stoptext
>
>
> -----------------------------------------------------------------
> Hans Hagen | PRAGMA ADE
> Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
>
[-- Attachment #1.2: Type: text/html, Size: 7241 bytes --]
[-- Attachment #2: 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] 6+ messages in thread
* Re: Best way to apply a fill-pattern to a closed shape?
2021-08-29 2:48 ` Ramkumar KB via ntg-context
@ 2021-08-29 9:17 ` Hans Hagen via ntg-context
2021-08-30 4:35 ` Ramkumar KB via ntg-context
0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen via ntg-context @ 2021-08-29 9:17 UTC (permalink / raw)
To: Ramkumar KB; +Cc: Hans Hagen, mailing list for ConTeXt users
On 8/29/2021 4:48 AM, Ramkumar KB wrote:
> Hans,
>
> Thank you for the snippets. These are super helpful (I am assuming
> commands like `withpatternscale` are MetaFun extensions and Wow!).
yes, just metafun, already there for a while ... (often examples show up
first in the test suite)
(if folks have wished for metafun they can let me know ... doing
metapost things is a nice distraction and with the mp extensions that we
have in luametatex we can do quite a lot)
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Best way to apply a fill-pattern to a closed shape?
2021-08-29 9:17 ` Hans Hagen via ntg-context
@ 2021-08-30 4:35 ` Ramkumar KB via ntg-context
2021-08-30 6:56 ` Hans Hagen via ntg-context
0 siblings, 1 reply; 6+ messages in thread
From: Ramkumar KB via ntg-context @ 2021-08-30 4:35 UTC (permalink / raw)
To: Hans Hagen; +Cc: Ramkumar KB, mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1342 bytes --]
Hans,
Thank you! Yes, it would be great to learn more about MetaFun - if you can
point me to the test suite, then I can document a few good tutorial level
examples in the Wiki (beginner & intermediate). MetaFun's turbo charged
capabilities are awesome!
One idea I am thinking (maybe for a student level project) would be MetaFun
library for Figma <https://www.figma.com/> (popular design tool).
best regards,
Ramkumar
On Sun, Aug 29, 2021 at 5:17 PM Hans Hagen <j.hagen@xs4all.nl> wrote:
> On 8/29/2021 4:48 AM, Ramkumar KB wrote:
> > Hans,
> >
> > Thank you for the snippets. These are super helpful (I am assuming
> > commands like `withpatternscale` are MetaFun extensions and Wow!).
>
> yes, just metafun, already there for a while ... (often examples show up
> first in the test suite)
>
> (if folks have wished for metafun they can let me know ... doing
> metapost things is a nice distraction and with the mp extensions that we
> have in luametatex we can do quite a lot)
>
> 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
> -----------------------------------------------------------------
>
[-- Attachment #1.2: Type: text/html, Size: 2012 bytes --]
[-- Attachment #2: 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] 6+ messages in thread
* Re: Best way to apply a fill-pattern to a closed shape?
2021-08-30 4:35 ` Ramkumar KB via ntg-context
@ 2021-08-30 6:56 ` Hans Hagen via ntg-context
0 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen via ntg-context @ 2021-08-30 6:56 UTC (permalink / raw)
To: Ramkumar KB; +Cc: Hans Hagen, mailing list for ConTeXt users
On 8/30/2021 6:35 AM, Ramkumar KB wrote:
> Hans,
>
> Thank you! Yes, it would be great to learn more about MetaFun - if you
> can point me to the test suite, then I can document a few good tutorial
> level examples in the Wiki (beginner & intermediate). MetaFun's turbo
> charged capabilities are awesome!
the test suite is a zip on the website alongside the others (not only
metafun)
best is to to look at the luametafun manual in the distribution (which
is anyway where the tests come from)
there is also the metafun manual (that i occasionally update / extend)
but the newest things are in the luametafun manual
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-08-30 6:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-28 9:33 Best way to apply a fill-pattern to a closed shape? Ramkumar KB via ntg-context
2021-08-28 11:02 ` Hans Hagen via ntg-context
2021-08-29 2:48 ` Ramkumar KB via ntg-context
2021-08-29 9:17 ` Hans Hagen via ntg-context
2021-08-30 4:35 ` Ramkumar KB via ntg-context
2021-08-30 6:56 ` Hans Hagen via ntg-context
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).