Re: [NTG-context] Metapost and TikZ color code equivalent
On 2/15/2020 12:25 PM, Fabrice Couvreur wrote: Hi Henri, Why does the blue path not rotate 90 with the draw command but rotate with the fill command? compare draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle rotated alpha withcolor red; draw (origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle) rotated alpha withcolor blue; \startMPcode def match (expr alpha, pos) = fill unitsquare xscaled 4cm yscaled 0.2cm rotated alpha shifted pos withcolor yellow ; fill origin -- (4cm,0) -- (4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle rotated alpha withcolor(.6yellow + black); draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle rotated alpha withcolor blue; draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle rotated alpha withcolor blue; draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm) rotated alpha; draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm) rotated alpha withshademethod "circular 1" withshadevector (0,1) withshadecolors (red,white); enddef; match(0,(0,0)); match(90,(4.2cm,0)); match(90,(0,0)); match(0,(0,4.2cm)); \stopMPcode- 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 ___
Re: [NTG-context] Metapost and TikZ color code equivalent
On 15-02-2020 12:25, Fabrice Couvreur wrote: > Hi Henri, > Why does the blue path not rotate 90 with the draw command but rotate > with the fill command? > Why not draw the match as a picture first, then rotate and shift that picture? Also, if you use a local scale unit, it will be easier to stach the matches together by merely applying a factor in match units. .F pEpkey.asc Description: application/pgp-keys ___ 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] Metapost and TikZ color code equivalent
Hi Henri, Why does the blue path not rotate 90 with the draw command but rotate with the fill command ? \startMPcode def match (expr alpha, pos) = fill unitsquare xscaled 4cm yscaled 0.2cm rotated alpha shifted pos withcolor yellow ; fill origin -- (4cm,0) -- (4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle rotated alpha withcolor(.6yellow + black); draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle rotated alpha withcolor blue; draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle rotated alpha withcolor blue; draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm) rotated alpha; draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm) rotated alpha withshademethod "circular 1" withshadevector (0,1) withshadecolors (red,white); enddef; match(0,(0,0)); match(90,(4.2cm,0)); match(90,(0,0)); match(0,(0,4.2cm)); \stopMPcode Le sam. 15 févr. 2020 à 00:01, Fabrice Couvreur a écrit : > Hi, > Hi, > I have corrected for the dimensions of the ellipse but I cannot achieve > the same effect for the red color. > Thank you. > Fabrice > \startMPcode > def match (expr pos) = > fill unitsquare xscaled 4cm yscaled 0.2cm shifted pos withcolor > yellow; > fill origin -- (4cm,0) -- (4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle > withcolor(.6yellow + black); > draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm) > -- (0.1cm,-0.05cm) -- cycle; > fill fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm) > withcolor red; > draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm); > draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm) > withshademethod "circular" > withshadevector (0,1) > withshadecolors (red,white) > enddef; > match((0,0)); > > \stopMPcode > > > > Le ven. 14 févr. 2020 à 16:43, Fabrice L a > écrit : > >> Hi, >> >> Le 13 févr. 2020 à 16:45, Fabrice Couvreur >> a écrit : >> >> >> How to have the color defined by {yellow!60!black} with Metapost ? >> >> >> color MyColor ; MyColor := .6[yellow,black] ; >> >> See metafun manual, section 1.13. >> >> Thank you. >> Fabrice >> >> >> Fabrice (another one !). >> >> >> ___ >> 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 >> >> ___ >> > ___ 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] Metapost and TikZ color code equivalent
Hi, Hi, I have corrected for the dimensions of the ellipse but I cannot achieve the same effect for the red color. Thank you. Fabrice \startMPcode def match (expr pos) = fill unitsquare xscaled 4cm yscaled 0.2cm shifted pos withcolor yellow; fill origin -- (4cm,0) -- (4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle withcolor(.6yellow + black); draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle; fill fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm) withcolor red; draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm); draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm) withshademethod "circular" withshadevector (0,1) withshadecolors (red,white) enddef; match((0,0)); \stopMPcode Le ven. 14 févr. 2020 à 16:43, Fabrice L a écrit : > Hi, > > Le 13 févr. 2020 à 16:45, Fabrice Couvreur > a écrit : > > > How to have the color defined by {yellow!60!black} with Metapost ? > > > color MyColor ; MyColor := .6[yellow,black] ; > > See metafun manual, section 1.13. > > Thank you. > Fabrice > > > Fabrice (another one !). > > > ___ > 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 > > ___ > ___ 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] Metapost and TikZ color code equivalent
Hi, > Le 13 févr. 2020 à 16:45, Fabrice Couvreur a > écrit : > How to have the color defined by {yellow!60!black} with Metapost ? color MyColor ; MyColor := .6[yellow,black] ; See metafun manual, section 1.13. > Thank you. > Fabrice Fabrice (another one !). > ___ > 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 ___
Re: [NTG-context] Metapost and TikZ color code equivalent
i Henri, Thank you for your answer. The idea is to make the graph as an attachment. I converted to Metapost but the road is still long! The code is from percusse on StackExchange. As you can see, there is a problem with the ellipse. How do I fix this ? Thank you Fabrice \usemodule[tikz] \starttext \startMPcode def match (expr pos) = fill unitsquare xscaled 4cm yscaled 0.2cm shifted pos withcolor yellow; fill origin -- (4cm,0) -- (4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle withcolor(.6yellow + black); draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle; fill fullcircle xscaled 0.25cm yscaled 0.22cm shifted (4.125cm,0.1cm) withcolor red; draw fullcircle xscaled 0.25cm yscaled 0.22cm shifted (4.125cm,0.1cm) withshademethod "circular" withshadevector (0,1) withshadecolors (red,white) enddef; match((0,0)); \stopMPcode \starttikzpicture \define[2]\allumette{ \fill [yellow] (#1,#2) rectangle (#1+4,#2+0.2); \fill [yellow!60!black] (#1,#2) -- ++(4,0)-- ++(0.1,-0.05) -- ++(-4,0) -- ++(-0.1,0.05); \draw (#1,#2) -- ++(0,0.2) -- ++(4,0) -- ++(0,-0.2) -- ++(0.1,-0.05) -- ++(-4,0) -- ++(-0.1,0.05); \shade[ball color=red] (#1+4,#2+0.1) ellipse (0.25cm and 0.22cm); \draw (#1+4,#2+0.1) ellipse (0.25cm and 0.22cm); } \allumette{0.1}{0.2} \filldraw[orange,scale=0.5,shift={(8.2,1.2)}] (0,0) .. controls (-1.5,1.25) and (.5,2) .. (-.2,4) .. controls (1,2.5) and (1,.5) .. (0,0); \stoptikzpicture \stoptext Le ven. 14 févr. 2020 à 02:49, Henri Menke a écrit : > On 2/14/20 10:45 AM, Fabrice Couvreur wrote: > > Hi, > > How to have the color defined by {yellow!60!black} with Metapost ? > > \usemodule[tikz] > \starttext > \startMPcode > fill fullsquare scaled 1cm withcolor (.6yellow + black) ; > \stopMPcode > > \starttikzpicture > \fill[yellow!60!black] (0,0) rectangle (1,1); > \stoptikzpicture > \stoptext > > > > Thank you. > > Fabrice > > > > > > > ___ > > 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 > > ___ > ___ 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] Metapost and TikZ color code equivalent
On 2/14/20 10:45 AM, Fabrice Couvreur wrote: > Hi, > How to have the color defined by {yellow!60!black} with Metapost ? \usemodule[tikz] \starttext \startMPcode fill fullsquare scaled 1cm withcolor (.6yellow + black) ; \stopMPcode \starttikzpicture \fill[yellow!60!black] (0,0) rectangle (1,1); \stoptikzpicture \stoptext > Thank you. > Fabrice > > > ___ > 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 ___