* metafun / patterns
@ 2021-03-25 13:11 Hans Hagen
2021-03-25 14:14 ` mf
2021-03-25 16:55 ` Aditya Mahajan
0 siblings, 2 replies; 4+ messages in thread
From: Hans Hagen @ 2021-03-25 13:11 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi,
As I'm still in metafun (and svg) mode I decided to support patterns
(that are already supported at the tex end) also in metafun. As there
has never been demands I suppose it's not that interesting but it sort
of fits in.
There are some tricky aspectx involved so the interface might evolve a
bit (some more control options) but here are some examples anyway:
\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]
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,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,1/8)
;
\stopMPcode
\page
% \stopTEXpage
% \startMPpage[instance=doublefun]
% draw closedcurve(unitsquare xyscaled (200,200) shifted (0,-200))
% withpattern image ( fill closedcurve(unitsquare xyscaled (50,50)
shifted (0,-50)) withcolor svgcolor(0.529,0.808,0.922) ; fill
closedcurve(unitsquare xyscaled (25,25) shifted (0,-25))
withshademethod "linear"
% withshadecenteronefraction (0,1)
% withshadecentertwofraction (0,0)
% withshadestep ( withshadefraction 0.05 withshadecolors
(svgcolor(1,0,0),svgcolor(1,0,0)) )
% withshadestep ( withshadefraction 0.95 withshadecolors
(svgcolor(1,0,0),svgcolor(1,0.5,0)) ) ; fill closedcurve((fullcircle
scaled 40 shifted (25,-25))) withshademethod "linear"
% withshadestep ( withshadefraction 0.05 withshadecolors
(svggray(1),svggray(1)) )
% withshadestep ( withshadefraction 0.95 withshadecolors
(svggray(1),svgcolor(0,0,1)) ) withopacity 0.5 ; )
% withpatternscale(1/4,1/4)
% ;
% \stopMPpage
% \startTEXpage
% \externalfigure[test.svg][conversion=mp,xobject=no]
% \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] 4+ messages in thread
* Re: metafun / patterns
2021-03-25 13:11 metafun / patterns Hans Hagen
@ 2021-03-25 14:14 ` mf
2021-03-25 14:20 ` mf
2021-03-25 16:55 ` Aditya Mahajan
1 sibling, 1 reply; 4+ messages in thread
From: mf @ 2021-03-25 14:14 UTC (permalink / raw)
To: ntg-context
Il 25/03/21 14:11, Hans Hagen ha scritto:
>
> \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
>
Those first two pages appear 20x20mm and blank.
Page 3 and 4 show patterns instead.
Massi
___________________________________________________________________________________
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] 4+ messages in thread
* Re: metafun / patterns
2021-03-25 14:14 ` mf
@ 2021-03-25 14:20 ` mf
0 siblings, 0 replies; 4+ messages in thread
From: mf @ 2021-03-25 14:20 UTC (permalink / raw)
To: ntg-context
Sorry for the noise, my fault: Thunderbird replaced some semicolon
combinations with emojis, so they were missing when I copied and pasted
them in a source file.
Massi
Il 25/03/21 15:14, mf ha scritto:
> Il 25/03/21 14:11, Hans Hagen ha scritto:
>>
>> \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
>>
>
> Those first two pages appear 20x20mm and blank.
>
> Page 3 and 4 show patterns instead.
>
> Massi
> ___________________________________________________________________________________
>
> 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
> ___________________________________________________________________________________
>
___________________________________________________________________________________
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] 4+ messages in thread
* Re: metafun / patterns
2021-03-25 13:11 metafun / patterns Hans Hagen
2021-03-25 14:14 ` mf
@ 2021-03-25 16:55 ` Aditya Mahajan
1 sibling, 0 replies; 4+ messages in thread
From: Aditya Mahajan @ 2021-03-25 16:55 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Thu, 25 Mar 2021, Hans Hagen wrote:
> Hi,
>
> As I'm still in metafun (and svg) mode I decided to support patterns
> (that are already supported at the tex end) also in metafun. As there
> has never been demands I suppose it's not that interesting but it sort
> of fits in.
>
> There are some tricky aspectx involved so the interface might evolve a
> bit (some more control options) but here are some examples anyway:
This is nice! I have used something like this in the past (but with "manual clipping", which is always cumbersome for irregular shapes).
Aditya
___________________________________________________________________________________
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] 4+ messages in thread
end of thread, other threads:[~2021-03-25 16:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-25 13:11 metafun / patterns Hans Hagen
2021-03-25 14:14 ` mf
2021-03-25 14:20 ` mf
2021-03-25 16:55 ` Aditya Mahajan
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).