* TikZ and wrong drawing order @ 2015-06-11 17:27 Mojca Miklavec 2015-06-11 17:59 ` Aditya Mahajan 2015-06-11 21:12 ` Hans Hagen 0 siblings, 2 replies; 19+ messages in thread From: Mojca Miklavec @ 2015-06-11 17:27 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Christian Feuersaenger [-- Attachment #1: Type: text/plain, Size: 636 bytes --] Hi, I would like to ask for help for either finding a fix or some clever workaround for the following problem. If I use a TikZ picture as item symbol and additionally use background text, then the first symbol in itemize environment gets covered by the background. Here's an example: \usemodule [tikz] \definesymbol[1] [{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}] \definecolor [backcol] [s=1,a=1,t=0.1] \starttext \startframedtext[width=4cm,background=color,backgroundcolor=backcol] \startitemize \item one \item two \item three \stopitemize \stopframedtext \stoptext Thank you, Mojca [-- Attachment #2: test.pdf --] [-- Type: application/pdf, Size: 5886 bytes --] [-- Attachment #3: Type: text/plain, Size: 485 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-11 17:27 TikZ and wrong drawing order Mojca Miklavec @ 2015-06-11 17:59 ` Aditya Mahajan 2015-06-11 20:14 ` Mojca Miklavec 2015-06-11 21:12 ` Hans Hagen 1 sibling, 1 reply; 19+ messages in thread From: Aditya Mahajan @ 2015-06-11 17:59 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Christian Feuersaenger On Thu, 11 Jun 2015, Mojca Miklavec wrote: > Hi, > > I would like to ask for help for either finding a fix or some clever > workaround for the following problem. > > If I use a TikZ picture as item symbol and additionally use background > text, then the first symbol in itemize environment gets covered by the > background. Here's an example: > > \usemodule > [tikz] > > \definesymbol[1] > [{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}] > > \definecolor > [backcol] > [s=1,a=1,t=0.1] > > \starttext > > \startframedtext[width=4cm,background=color,backgroundcolor=backcol] > \startitemize > \item one > \item two > \item three > \stopitemize > \stopframedtext > > \stoptext Workaround (though I have no idea why this should work). Use background={foreground,color} I wanted to test background={color, foreground}, but wrote the above by mistake and it works!!! 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-11 17:59 ` Aditya Mahajan @ 2015-06-11 20:14 ` Mojca Miklavec 2015-06-11 20:43 ` Aditya Mahajan 2015-06-11 21:26 ` Hans Hagen 0 siblings, 2 replies; 19+ messages in thread From: Mojca Miklavec @ 2015-06-11 20:14 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Christian Feuersaenger On Thu, Jun 11, 2015 at 7:59 PM, Aditya Mahajan wrote: > On Thu, 11 Jun 2015, Mojca Miklavec wrote: > >> Hi, >> >> I would like to ask for help for either finding a fix or some clever >> workaround for the following problem. >> >> If I use a TikZ picture as item symbol and additionally use background >> text, then the first symbol in itemize environment gets covered by the >> background. Here's an example: >> >> \usemodule >> [tikz] >> >> \definesymbol[1] >> [{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}] >> >> \definecolor >> [backcol] >> [s=1,a=1,t=0.1] >> >> \starttext >> >> \startframedtext[width=4cm,background=color,backgroundcolor=backcol] >> \startitemize >> \item one >> \item two >> \item three >> \stopitemize >> \stopframedtext >> >> \stoptext > > > Workaround (though I have no idea why this should work). Does it also work if you use the following? \definecolor [backcol] [s=1,a=1,t=0.95] > Use > > background={foreground,color} > > I wanted to test background={color, foreground}, but wrote the above by > mistake and it works!!! While it works in the sense that it gives a consistent look, it doesn't really lead to the desired result, at least not for me. The reason for using background colour in my case was to make text "visible" on a dark background photo. It doesn't really help if the main text gets hidden behind the semi-transparent layer. Unless you get different results than I do. Mojca ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-11 20:14 ` Mojca Miklavec @ 2015-06-11 20:43 ` Aditya Mahajan 2015-06-11 20:58 ` Mojca Miklavec 2015-06-11 21:26 ` Hans Hagen 1 sibling, 1 reply; 19+ messages in thread From: Aditya Mahajan @ 2015-06-11 20:43 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Christian Feuersaenger [-- Attachment #1: Type: TEXT/PLAIN, Size: 1593 bytes --] On Thu, 11 Jun 2015, Mojca Miklavec wrote: > On Thu, Jun 11, 2015 at 7:59 PM, Aditya Mahajan wrote: >> On Thu, 11 Jun 2015, Mojca Miklavec wrote: >> >>> Hi, >>> >>> I would like to ask for help for either finding a fix or some clever >>> workaround for the following problem. >>> >>> If I use a TikZ picture as item symbol and additionally use background >>> text, then the first symbol in itemize environment gets covered by the >>> background. Here's an example: >>> >> >> Workaround (though I have no idea why this should work). > >> background={foreground,color} > > While it works in the sense that it gives a consistent look, it > doesn't really lead to the desired result, at least not for me. The > reason for using background colour in my case was to make text > "visible" on a dark background photo. It doesn't really help if the > main text gets hidden behind the semi-transparent layer. I have no idea what tikz is doing: \usemodule[tikz] \definecolor[light][s=1,a=1,t=0.1] \definecolor[dark] [s=1,a=1,t=0.95] \defineframedtext[normal] [width=4cm, background=color] \defineframedtext[reverse][width=4cm, background={foreground,color}] \startbuffer \tikz\fill[color=blue] (0,0) circle (.2cm); \startMPcode fill fullcircle scaled (.4cm) withcolor \MPcolor{blue}; \stopMPcode \stopbuffer \starttext \startnormal[backgroundcolor=light] \getbuffer \stopnormal \startnormal[backgroundcolor=dark] \getbuffer \stopnormal \blank[3*line] \startreverse[backgroundcolor=light] \getbuffer \stopreverse \startreverse[backgroundcolor=dark] \getbuffer \stopreverse \stoptext Aditya [-- Attachment #2: Type: APPLICATION/pdf, Size: 5048 bytes --] [-- Attachment #3: Type: text/plain, Size: 485 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-11 20:43 ` Aditya Mahajan @ 2015-06-11 20:58 ` Mojca Miklavec 0 siblings, 0 replies; 19+ messages in thread From: Mojca Miklavec @ 2015-06-11 20:58 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Christian Feuersaenger On Thu, Jun 11, 2015 at 10:43 PM, Aditya Mahajan wrote: > On Thu, 11 Jun 2015, Mojca Miklavec wrote: >> On Thu, Jun 11, 2015 at 7:59 PM, Aditya Mahajan wrote: >>> On Thu, 11 Jun 2015, Mojca Miklavec wrote: >>> >>>> Hi, >>>> >>>> I would like to ask for help for either finding a fix or some clever >>>> workaround for the following problem. >>>> >>>> If I use a TikZ picture as item symbol and additionally use background >>>> text, then the first symbol in itemize environment gets covered by the >>>> background. Here's an example: >>>> >>> >>> Workaround (though I have no idea why this should work). >> >> >>> background={foreground,color} >> >> >> While it works in the sense that it gives a consistent look, it >> doesn't really lead to the desired result, at least not for me. The >> reason for using background colour in my case was to make text >> "visible" on a dark background photo. It doesn't really help if the >> main text gets hidden behind the semi-transparent layer. > > > I have no idea what tikz is doing: > > \usemodule[tikz] > > \definecolor[light][s=1,a=1,t=0.1] > \definecolor[dark] [s=1,a=1,t=0.95] > > \defineframedtext[normal] [width=4cm, background=color] > \defineframedtext[reverse][width=4cm, background={foreground,color}] > > \startbuffer > \tikz\fill[color=blue] (0,0) circle (.2cm); > \startMPcode fill fullcircle scaled (.4cm) withcolor \MPcolor{blue}; > \stopMPcode > \stopbuffer > > \starttext > > \startnormal[backgroundcolor=light] \getbuffer \stopnormal > \startnormal[backgroundcolor=dark] \getbuffer \stopnormal > > \blank[3*line] > > \startreverse[backgroundcolor=light] \getbuffer \stopreverse > \startreverse[backgroundcolor=dark] \getbuffer \stopreverse > \stoptext It's even more weird than that. The colour of the first item behind the "dark" depends on the colour of "light": \usemodule[tikz] \definecolor[extralight][s=1,a=1,t=0.1] \definecolor[light][s=1,a=1,t=0.6] \definecolor[dark] [s=1,a=1,t=0.95] \defineframedtext[normal] [width=6cm, background=color] \defineframedtext[reverse][width=6cm, background={foreground,color}] \startbuffer \tikz\fill[color=blue] (0,0) circle (.2cm);% \startMPcode fill fullcircle scaled (.4cm) withcolor \MPcolor{blue}; \stopMPcode \tikz\fill[color=blue] (0,0) circle (.2cm); \stopbuffer \starttext \startnormal[backgroundcolor=light] \getbuffer \stopnormal \startnormal[backgroundcolor=dark] \getbuffer \stopnormal \blank[2*line] \startreverse[backgroundcolor=light] \getbuffer \stopreverse \startreverse[backgroundcolor=dark] \getbuffer different \stopreverse \blank[2*line] \startreverse[backgroundcolor=extralight] \getbuffer \stopreverse \startreverse[backgroundcolor=dark] \getbuffer from this one \stopreverse \stoptext Mojca ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-11 20:14 ` Mojca Miklavec 2015-06-11 20:43 ` Aditya Mahajan @ 2015-06-11 21:26 ` Hans Hagen 2015-06-14 21:09 ` Mojca Miklavec 1 sibling, 1 reply; 19+ messages in thread From: Hans Hagen @ 2015-06-11 21:26 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Christian Feuersaenger On 6/11/2015 10:14 PM, Mojca Miklavec wrote: > On Thu, Jun 11, 2015 at 7:59 PM, Aditya Mahajan wrote: >> On Thu, 11 Jun 2015, Mojca Miklavec wrote: >> >>> Hi, >>> >>> I would like to ask for help for either finding a fix or some clever >>> workaround for the following problem. >>> >>> If I use a TikZ picture as item symbol and additionally use background >>> text, then the first symbol in itemize environment gets covered by the >>> background. Here's an example: >>> >>> \usemodule >>> [tikz] >>> >>> \definesymbol[1] >>> [{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}] >>> >>> \definecolor >>> [backcol] >>> [s=1,a=1,t=0.1] >>> >>> \starttext >>> >>> \startframedtext[width=4cm,background=color,backgroundcolor=backcol] >>> \startitemize >>> \item one >>> \item two >>> \item three >>> \stopitemize >>> \stopframedtext >>> >>> \stoptext >> >> >> Workaround (though I have no idea why this should work). > > Does it also work if you use the following? > > \definecolor > [backcol] > [s=1,a=1,t=0.95] > >> Use >> >> background={foreground,color} >> >> I wanted to test background={color, foreground}, but wrote the above by >> mistake and it works!!! > > While it works in the sense that it gives a consistent look, it > doesn't really lead to the desired result, at least not for me. The > reason for using background colour in my case was to make text > "visible" on a dark background photo. It doesn't really help if the > main text gets hidden behind the semi-transparent layer. > > Unless you get different results than I do. i suppose that tikz puts some pdf code in the output stream and this is likely to interfere with the way context deals with colors a solution is: {\red x\dontleavehmode\forcecolorhack\tikz\fill[color=blue] (0,0) circle (.2cm);x} the \forcecolorhack is, well, a hack that fools the optimizer and \dontleavehmode is needed to get tex in the right mode i have no time to look into the internals of tikz to see if a different trick is possible Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-11 21:26 ` Hans Hagen @ 2015-06-14 21:09 ` Mojca Miklavec 0 siblings, 0 replies; 19+ messages in thread From: Mojca Miklavec @ 2015-06-14 21:09 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Christian Feuersaenger On Thu, Jun 11, 2015 at 11:26 PM, Hans Hagen wrote: >>> On Thu, 11 Jun 2015, Mojca Miklavec wrote: >>> >>>> Hi, >>>> >>>> I would like to ask for help for either finding a fix or some clever >>>> workaround for the following problem. >>>> >>>> If I use a TikZ picture as item symbol and additionally use background >>>> text, then the first symbol in itemize environment gets covered by the >>>> background. Here's an example: >>>> >>>> \usemodule >>>> [tikz] >>>> >>>> \definesymbol[1] >>>> [{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}] >>>> >>>> \definecolor >>>> [backcol] >>>> [s=1,a=1,t=0.1] >>>> >>>> \starttext >>>> >>>> \startframedtext[width=4cm,background=color,backgroundcolor=backcol] >>>> \startitemize >>>> \item one >>>> \item two >>>> \item three >>>> \stopitemize >>>> \stopframedtext >>>> >>>> \stoptext > > i suppose that tikz puts some pdf code in the output stream and this is > likely to interfere with the way context deals with colors > > a solution is: > > {\red x\dontleavehmode\forcecolorhack\tikz\fill[color=blue] (0,0) circle > (.2cm);x} > > the > > \forcecolorhack > > is, well, a hack that fools the optimizer and \dontleavehmode is needed to > get tex in the right mode Thank you very much. Using the following worked fine as a workaround. \definesymbol[1] [{\dontleavehmode\forcecolorhack\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}] Meanwhile I filed a ticket to the pgf's bug tracker to help us remember specifics about the problem. Mojca ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-11 17:27 TikZ and wrong drawing order Mojca Miklavec 2015-06-11 17:59 ` Aditya Mahajan @ 2015-06-11 21:12 ` Hans Hagen 2015-06-11 22:28 ` Mojca Miklavec 1 sibling, 1 reply; 19+ messages in thread From: Hans Hagen @ 2015-06-11 21:12 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Christian Feuersaenger On 6/11/2015 7:27 PM, Mojca Miklavec wrote: > Hi, > > I would like to ask for help for either finding a fix or some clever > workaround for the following problem. > > If I use a TikZ picture as item symbol and additionally use background > text, then the first symbol in itemize environment gets covered by the > background. Here's an example: > > \usemodule > [tikz] > > \definesymbol[1] > [{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}] \startreusableMPgraphic{bullet} fill fullcircle scaled (1EmWidth) withshademethod "circular" withcolor red shadedinto blue ; \stopreusableMPgraphic \definesymbol[1]{\reuseMPgraphic{bullet}} ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-11 21:12 ` Hans Hagen @ 2015-06-11 22:28 ` Mojca Miklavec 2015-06-11 22:45 ` Hans Hagen 2015-06-12 7:11 ` Alan BRASLAU 0 siblings, 2 replies; 19+ messages in thread From: Mojca Miklavec @ 2015-06-11 22:28 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Christian Feuersaenger On Thu, Jun 11, 2015 at 11:12 PM, Hans Hagen wrote: > On 6/11/2015 7:27 PM, Mojca Miklavec wrote: >> >> \usemodule >> [tikz] >> >> \definesymbol[1] >> [{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}] > > > \startreusableMPgraphic{bullet} > fill fullcircle > scaled (1EmWidth) > withshademethod "circular" > withcolor red shadedinto blue ; > \stopreusableMPgraphic > > \definesymbol[1]{\reuseMPgraphic{bullet}} Thank you. But TikZ simply delivers a "superior" result in this case (= better tuned). We should figure out how exactly the shading is done there (it's slightly eccentric etc.) and try to prepare a macro for metafun that delivers the same result (or at least a compatible one) with an input of a single colour as a parameter. Mojca ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-11 22:28 ` Mojca Miklavec @ 2015-06-11 22:45 ` Hans Hagen 2015-06-14 21:26 ` Mojca Miklavec 2015-06-12 7:11 ` Alan BRASLAU 1 sibling, 1 reply; 19+ messages in thread From: Hans Hagen @ 2015-06-11 22:45 UTC (permalink / raw) To: ntg-context; +Cc: ludewich On 6/12/2015 12:28 AM, Mojca Miklavec wrote: > On Thu, Jun 11, 2015 at 11:12 PM, Hans Hagen wrote: >> On 6/11/2015 7:27 PM, Mojca Miklavec wrote: >>> >>> \usemodule >>> [tikz] >>> >>> \definesymbol[1] >>> [{\tikz\shade[shading=ball,ball color=blue] (0,0) circle (.2cm);}] >> >> >> \startreusableMPgraphic{bullet} >> fill fullcircle >> scaled (1EmWidth) >> withshademethod "circular" >> withcolor red shadedinto blue ; >> \stopreusableMPgraphic >> >> \definesymbol[1]{\reuseMPgraphic{bullet}} > > Thank you. But TikZ simply delivers a "superior" result in this case > (= better tuned). We should figure out how exactly the shading is done > there (it's slightly eccentric etc.) and try to prepare a macro for > metafun that delivers the same result (or at least a compatible one) > with an input of a single colour as a parameter. Most shades look ugly and useless to me anyway but you have more control than you think (always had but nicer interfaced in mpiv): \startMPpage fill fullcircle scaled 10cm withshademethod "circular" withshadevector (5cm,1cm) withshadecenter (.1,.5) withshadedomain (.2,.6) withshadefactor 1.2 withshadecolors (red,green) ; \stopMPage Of course you need to play with the values as there is no 'best' combination. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-11 22:45 ` Hans Hagen @ 2015-06-14 21:26 ` Mojca Miklavec 2015-06-14 21:38 ` Mojca Miklavec ` (2 more replies) 0 siblings, 3 replies; 19+ messages in thread From: Mojca Miklavec @ 2015-06-14 21:26 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Christian Feuersaenger On Fri, Jun 12, 2015 at 12:45 AM, Hans Hagen wrote: > > Most shades look ugly and useless to me anyway but you have more control > than you think (always had but nicer interfaced in mpiv): > > \startMPpage > fill fullcircle scaled 10cm > withshademethod "circular" > withshadevector (5cm,1cm) > withshadecenter (.1,.5) > withshadedomain (.2,.6) > withshadefactor 1.2 > withshadecolors (red,green) > ; > \stopMPage Great, I love the new syntax (compared to the MKII "ugliness" of shadings). But how does one declare more than one colour? In particular, how would you do the following in MP? \usemodule [tikz] \pgfdeclareverticalshading{rainbow}{100bp}{ color(0bp)=(red); color(25bp)=(red); color(35bp)=(yellow); color(45bp)=(green); color(55bp)=(cyan); color(65bp)=(blue); color(75bp)=(violet); color(100bp)=(violet)} \starttext \starttikzpicture[shading=rainbow] \shade[shading angle=90] (0,0) rectangle +(10,1); \stoptikzpicture \stoptext > Of course you need to play with the values as there is no 'best' > combination. This is how TikZ defines the ball: \pgfdeclareradialshading[tikz@ball]{ball}{\pgfqpoint{-10bp}{10bp}}{% color(0bp)=(tikz@ball!15!white); color(9bp)=(tikz@ball!75!white); color(18bp)=(tikz@ball!70!black); color(25bp)=(tikz@ball!50!black); color(50bp)=(black)} Your example uses just two colours, while TikZ uses five and I don't know how to translate this "ball shading" to MP (I know or at least knew how to do it in plain PostScript and could dig it up; I think it uses function shading with predefined colours at predefined distances, but it's all a single shading (a single function), not a composition of multiple sections). Mojca ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-14 21:26 ` Mojca Miklavec @ 2015-06-14 21:38 ` Mojca Miklavec 2015-06-15 7:43 ` Hans Hagen 2015-06-15 11:47 ` Hans Hagen 2 siblings, 0 replies; 19+ messages in thread From: Mojca Miklavec @ 2015-06-14 21:38 UTC (permalink / raw) To: mailing list for ConTeXt users See also: http://tex.stackexchange.com/questions/54193/how-to-draw-a-shaded-sphere Mojca ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-14 21:26 ` Mojca Miklavec 2015-06-14 21:38 ` Mojca Miklavec @ 2015-06-15 7:43 ` Hans Hagen 2015-06-15 8:02 ` Mojca Miklavec 2015-06-15 9:48 ` Alan BRASLAU 2015-06-15 11:47 ` Hans Hagen 2 siblings, 2 replies; 19+ messages in thread From: Hans Hagen @ 2015-06-15 7:43 UTC (permalink / raw) To: ntg-context On 6/14/2015 11:26 PM, Mojca Miklavec wrote: > On Fri, Jun 12, 2015 at 12:45 AM, Hans Hagen wrote: >> >> Most shades look ugly and useless to me anyway but you have more control >> than you think (always had but nicer interfaced in mpiv): >> >> \startMPpage >> fill fullcircle scaled 10cm >> withshademethod "circular" >> withshadevector (5cm,1cm) >> withshadecenter (.1,.5) >> withshadedomain (.2,.6) >> withshadefactor 1.2 >> withshadecolors (red,green) >> ; >> \stopMPage > > Great, I love the new syntax (compared to the MKII "ugliness" of shadings). well, even mkii could do some magic if one went a bit more low level shading is quite old actually (dates from before tikz showed up -) i have in my mailbox a mail from 1999 from mathew that demos a function shading (some perl code) which is the way to go with more advanced shades > But how does one declare more than one colour? In particular, how > would you do the following in MP? > > \usemodule > [tikz] > > \pgfdeclareverticalshading{rainbow}{100bp}{ > color(0bp)=(red); > color(25bp)=(red); > color(35bp)=(yellow); > color(45bp)=(green); > color(55bp)=(cyan); > color(65bp)=(blue); > color(75bp)=(violet); > color(100bp)=(violet)} > > \starttext > \starttikzpicture[shading=rainbow] > \shade[shading angle=90] (0,0) rectangle +(10,1); > \stoptikzpicture > \stoptext you're one of those people infected by apple software where shades are (of maybe were) the fashion (next thing you will ask to simulate perkament behind your pages or leather looking cover pages) ... aka patterns in ps >> Of course you need to play with the values as there is no 'best' >> combination. > > This is how TikZ defines the ball: > > \pgfdeclareradialshading[tikz@ball]{ball}{\pgfqpoint{-10bp}{10bp}}{% > color(0bp)=(tikz@ball!15!white); > color(9bp)=(tikz@ball!75!white); > color(18bp)=(tikz@ball!70!black); > color(25bp)=(tikz@ball!50!black); > color(50bp)=(black)} that's mostly a shade made out of steps (in the pdf one shade operation but not better than 8 shades next to each other) ... personally i dislike such granular shaded (either do it good or don't do it at all) (btw in context code will look a bit more complex because we also need to deal with spot colors, multi-tones, cmyk, etc) > Your example uses just two colours, while TikZ uses five and I don't > know how to translate this "ball shading" to MP (I know or at least > knew how to do it in plain PostScript and could dig it up; I think it > uses function shading with predefined colours at predefined distances, > but it's all a single shading (a single function), not a composition > of multiple sections). something similar to <</Shading << /Sh << /ShadingType 2 /ColorSpace /DeviceRGB /Domain [0.0 100.00128] /Coords [0 0.0 0 100.00128] /Function << /FunctionType 3 /Domain [0.0 100.00128] /Functions [ << /FunctionType 2 /Domain [0.0 100.00128] /C0 [1 0 0] /C1 [1 0 0] /N 1 >> << /FunctionType 2 /Domain [0.0 100.00128] /C0 [1 0 0] /C1 [1 1 0] /N 1 >> << /FunctionType 2 /Domain [0.0 100.00128] /C0 [1 1 0] /C1 [0 1 0] /N 1 >> << /FunctionType 2 /Domain [0.0 100.00128] /C0 [0 1 0] /C1 [0 1 1] /N 1 >> << /FunctionType 2 /Domain [0.0 100.00128] /C0 [0 1 1] /C1 [0 0 1] /N 1 >> << /FunctionType 2 /Domain [0.0 100.00128] /C0 [0 0 1] /C1 [0 0 0] /N 1 >> << /FunctionType 2 /Domain [0.0 100.00128] /C0 [0 0 0] /C1 [0 0 0] /N 1 >> ] /Bounds [ 25.00032 35.00043 45.00056 55.00069 65.00082 75.00096] /Encode [0 1 0 1 0 1 0 1 0 1 0 1 0 1] >> /Extend [false false] >> >>/ProcSet[/PDF] >> not too hard to program (if i can motivate myself) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-15 7:43 ` Hans Hagen @ 2015-06-15 8:02 ` Mojca Miklavec 2015-06-15 13:02 ` Hans Hagen 2015-06-15 9:48 ` Alan BRASLAU 1 sibling, 1 reply; 19+ messages in thread From: Mojca Miklavec @ 2015-06-15 8:02 UTC (permalink / raw) To: mailing list for ConTeXt users On Mon, Jun 15, 2015 at 9:43 AM, Hans Hagen wrote: > On 6/14/2015 11:26 PM, Mojca Miklavec wrote: >> >> On Fri, Jun 12, 2015 at 12:45 AM, Hans Hagen wrote: >>> >>> >>> Most shades look ugly and useless to me anyway but you have more control >>> than you think (always had but nicer interfaced in mpiv): >>> >>> \startMPpage >>> fill fullcircle scaled 10cm >>> withshademethod "circular" >>> withshadevector (5cm,1cm) >>> withshadecenter (.1,.5) >>> withshadedomain (.2,.6) >>> withshadefactor 1.2 >>> withshadecolors (red,green) >>> ; >>> \stopMPage >> >> >> Great, I love the new syntax (compared to the MKII "ugliness" of >> shadings). > > > well, even mkii could do some magic if one went a bit more low level I know. The resulting PDF was great, but doing any programming in MkII was a nightmare. > shading is quite old actually (dates from before tikz showed up -) TikZ is a relatively recent piece of software. > i have in my mailbox a mail from 1999 from mathew that demos a function > shading (some perl code) which is the way to go with more advanced shades > >> But how does one declare more than one colour? In particular, how >> would you do the following in MP? >> >> \usemodule >> [tikz] >> >> \pgfdeclareverticalshading{rainbow}{100bp}{ >> color(0bp)=(red); >> color(25bp)=(red); >> color(35bp)=(yellow); >> color(45bp)=(green); >> color(55bp)=(cyan); >> color(65bp)=(blue); >> color(75bp)=(violet); >> color(100bp)=(violet)} >> >> \starttext >> \starttikzpicture[shading=rainbow] >> \shade[shading angle=90] (0,0) rectangle +(10,1); >> \stoptikzpicture >> \stoptext > > > you're one of those people infected by apple software where shades are (of > maybe were) the fashion Actually, some shadings in PDF are broken in Apple's libraries. The output of Asymptote (and some output of my own simulations) can sometimes only be rendered properly by Acrobat, while Apple software would simply crash or render pure nonsense. > (next thing you will ask to simulate perkament > behind your pages or leather looking cover pages) ... aka patterns in ps Thanks for the idea ;) >>> Of course you need to play with the values as there is no 'best' >>> combination. >> >> >> This is how TikZ defines the ball: >> >> \pgfdeclareradialshading[tikz@ball]{ball}{\pgfqpoint{-10bp}{10bp}}{% >> color(0bp)=(tikz@ball!15!white); >> color(9bp)=(tikz@ball!75!white); >> color(18bp)=(tikz@ball!70!black); >> color(25bp)=(tikz@ball!50!black); >> color(50bp)=(black)} > > > that's mostly a shade made out of steps (in the pdf one shade operation but > not better than 8 shades next to each other) 8 shades next to each other are probably less efficient and might render with "holes" in non-Acrobat buggy renderers. But your example below looks like it should be interpreted as a "single shading" (it uses a single function), so it should work fine. What is the decimal part (".00128") used for? > ... personally i dislike such > granular shaded (either do it good or don't do it at all) > > (btw in context code will look a bit more complex because we also need to > deal with spot colors, multi-tones, cmyk, etc) > >> Your example uses just two colours, while TikZ uses five and I don't >> know how to translate this "ball shading" to MP (I know or at least >> knew how to do it in plain PostScript and could dig it up; I think it >> uses function shading with predefined colours at predefined distances, >> but it's all a single shading (a single function), not a composition >> of multiple sections). > > > something similar to > > <</Shading << /Sh << > /ShadingType 2 > /ColorSpace > /DeviceRGB > /Domain [0.0 100.00128] > /Coords [0 0.0 0 100.00128] > /Function << > /FunctionType 3 > /Domain [0.0 100.00128] > /Functions [ > << /FunctionType 2 /Domain [0.0 100.00128] /C0 [1 0 0] /C1 [1 0 0] /N > 1 >> > << /FunctionType 2 /Domain [0.0 100.00128] /C0 [1 0 0] /C1 [1 1 0] /N > 1 >> > << /FunctionType 2 /Domain [0.0 100.00128] /C0 [1 1 0] /C1 [0 1 0] /N > 1 >> > << /FunctionType 2 /Domain [0.0 100.00128] /C0 [0 1 0] /C1 [0 1 1] /N > 1 >> > << /FunctionType 2 /Domain [0.0 100.00128] /C0 [0 1 1] /C1 [0 0 1] /N > 1 >> > << /FunctionType 2 /Domain [0.0 100.00128] /C0 [0 0 1] /C1 [0 0 0] /N > 1 >> > << /FunctionType 2 /Domain [0.0 100.00128] /C0 [0 0 0] /C1 [0 0 0] /N > 1 >> > ] > /Bounds [ 25.00032 35.00043 45.00056 55.00069 65.00082 75.00096] > /Encode [0 1 0 1 0 1 0 1 0 1 0 1 0 1] >> > /Extend [false false] >>> >>/ProcSet[/PDF] >> > > not too hard to program (if i can motivate myself) Talking about old examples ... here's an example in pure PostScript that achieves a desired result, including your response (however it doesn't support specifying the locations of colours): http://www.ntg.nl/pipermail/ntg-context/2006/022833.html Mojca ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-15 8:02 ` Mojca Miklavec @ 2015-06-15 13:02 ` Hans Hagen 2015-06-15 13:36 ` Mojca Miklavec 0 siblings, 1 reply; 19+ messages in thread From: Hans Hagen @ 2015-06-15 13:02 UTC (permalink / raw) To: ntg-context On 6/15/2015 10:02 AM, Mojca Miklavec wrote: > What is the decimal part (".00128") used for? it's what tikz produces as output ... a rounding error i guess Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-15 13:02 ` Hans Hagen @ 2015-06-15 13:36 ` Mojca Miklavec 0 siblings, 0 replies; 19+ messages in thread From: Mojca Miklavec @ 2015-06-15 13:36 UTC (permalink / raw) To: mailing list for ConTeXt users On Mon, Jun 15, 2015 at 3:02 PM, Hans Hagen wrote: > On 6/15/2015 10:02 AM, Mojca Miklavec wrote: > >> What is the decimal part (".00128") used for? > > it's what tikz produces as output ... a rounding error i guess Ah, ok, I din't know that you were using the TikZ output. Then it's more likely related to "bigpoint" (bp), but that's pure speculation. Mojca ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-15 7:43 ` Hans Hagen 2015-06-15 8:02 ` Mojca Miklavec @ 2015-06-15 9:48 ` Alan BRASLAU 1 sibling, 0 replies; 19+ messages in thread From: Alan BRASLAU @ 2015-06-15 9:48 UTC (permalink / raw) To: Hans Hagen; +Cc: ntg-context On Mon, 15 Jun 2015 09:43:38 +0200 Hans Hagen <pragma@wxs.nl> wrote: > you're one of those people infected by apple software where shades > are (of maybe were) the fashion Eye candy, goes in and out of fashion... > that's mostly a shade made out of steps (in the pdf one shade > operation but not better than 8 shades next to each other) 8 shades of gray? Alan ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-14 21:26 ` Mojca Miklavec 2015-06-14 21:38 ` Mojca Miklavec 2015-06-15 7:43 ` Hans Hagen @ 2015-06-15 11:47 ` Hans Hagen 2 siblings, 0 replies; 19+ messages in thread From: Hans Hagen @ 2015-06-15 11:47 UTC (permalink / raw) To: mailing list for ConTeXt users On 6/14/2015 11:26 PM, Mojca Miklavec wrote: > Your example uses just two colours, while TikZ uses five and I don't > know how to translate this "ball shading" to MP (I know or at least > knew how to do it in plain PostScript and could dig it up; I think it > uses function shading with predefined colours at predefined distances, > but it's all a single shading (a single function), not a composition > of multiple sections). Ok, as I suppose you need it for you thesis ... a new beta ... I didn't play with values for the circular one but here's a linear: \startMPpage fill fullsquare scaled 50pt withshademethod "linear" withshadevector (0,1) withshadestep ( withshadefraction .3 withshadecolors (red,green) ) withshadestep ( withshadefraction .5 withshadecolors (green,blue) ) withshadestep ( withshadefraction .7 withshadecolors (blue,red) ) withshadestep ( withshadefraction 1 withshadecolors (red,yellow) ) ; fill fullsquare scaled 50pt shifted(60pt,0) withshademethod "linear" withshadevector (0,1) withshadecolors (red,green) ; \stopMPpage so the withshadestep is new Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: TikZ and wrong drawing order 2015-06-11 22:28 ` Mojca Miklavec 2015-06-11 22:45 ` Hans Hagen @ 2015-06-12 7:11 ` Alan BRASLAU 1 sibling, 0 replies; 19+ messages in thread From: Alan BRASLAU @ 2015-06-12 7:11 UTC (permalink / raw) To: Mojca Miklavec; +Cc: mailing list for ConTeXt users, Christian Feuersaenger On Fri, 12 Jun 2015 00:28:43 +0200 Mojca Miklavec <mojca.miklavec.lists@gmail.com> wrote: > Thank you. But TikZ simply delivers a "superior" result in this case > (= better tuned). Pfluff! Alan ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2015-06-15 13:36 UTC | newest] Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-06-11 17:27 TikZ and wrong drawing order Mojca Miklavec 2015-06-11 17:59 ` Aditya Mahajan 2015-06-11 20:14 ` Mojca Miklavec 2015-06-11 20:43 ` Aditya Mahajan 2015-06-11 20:58 ` Mojca Miklavec 2015-06-11 21:26 ` Hans Hagen 2015-06-14 21:09 ` Mojca Miklavec 2015-06-11 21:12 ` Hans Hagen 2015-06-11 22:28 ` Mojca Miklavec 2015-06-11 22:45 ` Hans Hagen 2015-06-14 21:26 ` Mojca Miklavec 2015-06-14 21:38 ` Mojca Miklavec 2015-06-15 7:43 ` Hans Hagen 2015-06-15 8:02 ` Mojca Miklavec 2015-06-15 13:02 ` Hans Hagen 2015-06-15 13:36 ` Mojca Miklavec 2015-06-15 9:48 ` Alan BRASLAU 2015-06-15 11:47 ` Hans Hagen 2015-06-12 7:11 ` Alan BRASLAU
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).