Re: [NTG-context] Shading
Hi Wolfgang, I would like the same result as the code with TikZ. Thank you. Fabrice \usemodule[tikz] \starttext \startMPcode fill fullcircle xscaled 1cm yscaled 0.88cm shaded withshademethod "circular" withshadefactor 0.75 withshadecolors (white,red); \stopMPcode \starttikzpicture \shade[ball color=red] (0,0) ellipse (0.5cm and 0.44cm); \stoptikzpicture \stoptext Le mar. 25 févr. 2020 à 17:18, Wolfgang Schuster < wolfgang.schuster.li...@gmail.com> a écrit : > On Tue, 25 Feb 2020 12:34:00 +0100 > Fabrice Couvreur wrote: > > > Hi, > > In the Metafun documentation on page 410, there is a shaded bullet "fill > > fullcircle shaded cshade". > > I tried to reproduce the same effect, but it is not exactly the same > result. > > It's different because your code isn't the same as the example in the > manual. > > \starttext > > \startMPcode > fill fullcircle scaled 4cm shaded withshademethod "circular" ; > \stopMPcode > > \stoptext > > > \starttext > > \startMPcode > > fill fullcircle scaled 4cm shaded withshademethod "circular" > >withshadevector (1,0) > >withshadecolors (red, white) ; > > \stopMPcode > > \stoptext > > Not sure what you're trying to achieve but this is closer the example > above. > > \starttext > > \startMPcode > fill fullcircle scaled 4cm shaded > withshademethod "circular" > withshadefactor 0.75 > withshadecolors (white,red) > ; > \stopMPcode > > \stoptext > > Wolfgang > > ___ > 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] Shading
On Tue, 25 Feb 2020 12:34:00 +0100 Fabrice Couvreur wrote: > Hi, > In the Metafun documentation on page 410, there is a shaded bullet "fill > fullcircle shaded cshade". > I tried to reproduce the same effect, but it is not exactly the same result. It's different because your code isn't the same as the example in the manual. \starttext \startMPcode fill fullcircle scaled 4cm shaded withshademethod "circular" ; \stopMPcode \stoptext > \starttext > \startMPcode > fill fullcircle scaled 4cm shaded withshademethod "circular" >withshadevector (1,0) >withshadecolors (red, white) ; > \stopMPcode > \stoptext Not sure what you're trying to achieve but this is closer the example above. \starttext \startMPcode fill fullcircle scaled 4cm shaded withshademethod "circular" withshadefactor 0.75 withshadecolors (white,red) ; \stopMPcode \stoptext Wolfgang ___ 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] Shading and transparency
On Thu, 12 Jul 2018 22:59:05 +0200 Hans Hagen wrote: > hm, I'm puzzled as a shade doesn't go between colors + transparent > but from one color to another (in the same color space) and > transparency is just a different mechanism > > maybe it was some side effect of chosen values / vectors that gave > the combined impression (which is why i want to see the pdf made by > context that you use as reference) I just checked some older projects and the older versions. I used a mix between - linear_shade… - withshading("linear"… - withshademethod "linear" … depending on the age of the project. And I fail to find a project using transparent shading where the transparency is done in context. I could not get it working now on the older versions. Maybe you're right and it has never worked the way I thought it had. Sorry for the noise. > \setupbackgrounds [page] [background=color, backgroundcolor=lightgray] > > \starttext > > \startuseMPgraphic{test} > graycolor white; white := 1 ; > fill OverlayBox > withshademethod "linear" > withshadedirection shadedup > withshadefactor 1.5 > withshadecolors (.85white,white) >% withtransparency (multiplytransparent,.7) > withtransparency (normaltransparent,.7) > \stopuseMPgraphic > > \defineoverlay[test][\useMPgraphic{test}] > > \framed >[align=middle,background={foreground,test}] >{\samplefile{sapolsky}} > > \stoptext That's basically shading to the background colour, which gives the impression of transparency. I've been using that. Works most of the time. But it's not the same. See the attached file and compare. I guess I'll keep using the external file overlay then. > > Just run the first example with an old context version. The file > > gradient-t from my last mail was created using inkscape as I don't > > want a single project to depend on two different context versions. > you're kidding ... i have no old context on my machine Silly me :) Marco 0nC.pdf Description: Adobe PDF document ___ 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] Shading and transparency
On 7/12/2018 10:08 PM, Marco Patzer wrote: On Thu, 12 Jul 2018 11:21:45 +0200 Hans Hagen wrote: For the old implementation (pre 2016-ish) I had a working solution because shading to transparent colours just worked (at least in my case of a simple transparent shade, nothing fancy), but not so any longer. With the new implementation I couldn't get it working. But we discussed that at some point in the past. I believe the gist of it was “shade-to-transparent is gone”. i'm not ssure what shade to transparency means I mean a shade from a colour (e.g. black) to transparent. For instance this used to work pre 2016: \setupbackgrounds [page] [background=color, backgroundcolor=lightgray] \definecolor [trans] [a=multiply, t=1, s=1] \starttext \startMPcode path p; p:=fullsquare xyscaled (5cm, 5cm); fill p withshading("linear", ulcorner p, llcorner p) withfromshadecolor \MPcolor{white} withtoshadecolor \MPcolor{trans}; \stopMPcode \stoptext The shade goes from white to transparent (here lightgray, that's the page colour). I assume you have an older context laying around to run the example above. ... shades can be transparent currently Yes, but the *whole* shade is made transparent. Currently I don't know a way to shade from e.g. black to transparent (no colour). The colour involved in the shading can't have transparency, or if they do one has to use \MPcoloronly to get rid of the transparency part. hm, I'm puzzled as a shade doesn't go between colors + transparent but from one color to another (in the same color space) and transparency is just a different mechanism maybe it was some side effect of chosen values / vectors that gave the combined impression (which is why i want to see the pdf made by context that you use as reference) anyway, it helps to be in the same color space \setupbackgrounds [page] [background=color, backgroundcolor=lightgray] \starttext \startuseMPgraphic{test} graycolor white; white := 1 ; fill OverlayBox withshademethod "linear" withshadedirection shadedup withshadefactor 1.5 withshadecolors (.85white,white) % withtransparency (multiplytransparent,.7) withtransparency (normaltransparent,.7) \stopuseMPgraphic \defineoverlay[test][\useMPgraphic{test}] \framed [align=middle,background={foreground,test}] {\samplefile{sapolsky}} \stoptext So the above old syntax roughly translated to the current implementation: \setupbackgrounds [page] [background=color, backgroundcolor=lightgray] \definecolor [trans] [a=multiply, t=1, s=1] \starttext \startMPcode path p; p:=fullsquare xyscaled (5cm, 5cm); fill p withshademethod "linear" withshadevector (3, 0) %% since "trans" contains transparency, one has to use \MPcoloronly withshadecolors (white, \MPcoloronly{trans}) withtransparency (.5, .5) %% withtransparency \MPtransparency{trans} ; \stopMPcode \stoptext .. so how did that old file (uncompressed pdf) look like then Just run the first example with an old context version. The file gradient-t from my last mail was created using inkscape as I don't want a single project to depend on two different context versions. you're kidding ... i have no old context on my machine 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 ___
Re: [NTG-context] Shading and transparency
On Thu, 12 Jul 2018 11:21:45 +0200 Hans Hagen wrote: > > For the old implementation (pre 2016-ish) I had a working solution > > because shading to transparent colours just worked (at least in my > > case of a simple transparent shade, nothing fancy), but not so any > > longer. With the new implementation I couldn't get it working. But > > we discussed that at some point in the past. I believe the gist of > > it was “shade-to-transparent is gone”. > > i'm not ssure what shade to transparency means I mean a shade from a colour (e.g. black) to transparent. For instance this used to work pre 2016: \setupbackgrounds [page] [background=color, backgroundcolor=lightgray] \definecolor [trans] [a=multiply, t=1, s=1] \starttext \startMPcode path p; p:=fullsquare xyscaled (5cm, 5cm); fill p withshading("linear", ulcorner p, llcorner p) withfromshadecolor \MPcolor{white} withtoshadecolor \MPcolor{trans}; \stopMPcode \stoptext The shade goes from white to transparent (here lightgray, that's the page colour). I assume you have an older context laying around to run the example above. > ... shades can be transparent currently Yes, but the *whole* shade is made transparent. Currently I don't know a way to shade from e.g. black to transparent (no colour). The colour involved in the shading can't have transparency, or if they do one has to use \MPcoloronly to get rid of the transparency part. So the above old syntax roughly translated to the current implementation: \setupbackgrounds [page] [background=color, backgroundcolor=lightgray] \definecolor [trans] [a=multiply, t=1, s=1] \starttext \startMPcode path p; p:=fullsquare xyscaled (5cm, 5cm); fill p withshademethod "linear" withshadevector (3, 0) %% since "trans" contains transparency, one has to use \MPcoloronly withshadecolors (white, \MPcoloronly{trans}) withtransparency (.5, .5) %% withtransparency \MPtransparency{trans} ; \stopMPcode \stoptext > .. so how did that old file (uncompressed pdf) look like then Just run the first example with an old context version. The file gradient-t from my last mail was created using inkscape as I don't want a single project to depend on two different context versions. Marco ___ 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] Shading and transparency
On 7/11/2018 11:40 PM, Marco Patzer wrote: On Wed, 11 Jul 2018 23:11:31 +0200 Hans Hagen wrote: Is there a method that does not require an external file or pre-processing? Using the external file works. Just wondering if there's a better - more integrated - way. i guess that with some experimenting you can come close but the external file that you use uses masks (actually we do support masks in external figures) and multiple shades over something in the page stream For the old implementation (pre 2016-ish) I had a working solution because shading to transparent colours just worked (at least in my case of a simple transparent shade, nothing fancy), but not so any longer. With the new implementation I couldn't get it working. But we discussed that at some point in the past. I believe the gist of it was “shade-to-transparent is gone”. i'm not ssure what shade to transparency means ... shades can be transparent currently .. so how did that old file (uncompressed pdf) look like then stuff i'd only look into when i have to (in principle one can make all kind of fancy mechanisms but does it pay off ... seldom) If there's no easy solution, it's alright. If have a workaround. No need to waste time on exotic features (as long as masks in external figures keep working). Still, if you happen to know a trick to pull that off in ConTeXt, let me know. Marco -- - 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] Shading and transparency
On Wed, 11 Jul 2018 23:11:31 +0200 Hans Hagen wrote: > > Is there a method that does not require an external file or > > pre-processing? Using the external file works. Just wondering if > > there's a better - more integrated - way. > i guess that with some experimenting you can come close but the > external file that you use uses masks (actually we do support masks > in external figures) and multiple shades over something in the page > stream For the old implementation (pre 2016-ish) I had a working solution because shading to transparent colours just worked (at least in my case of a simple transparent shade, nothing fancy), but not so any longer. With the new implementation I couldn't get it working. But we discussed that at some point in the past. I believe the gist of it was “shade-to-transparent is gone”. > stuff i'd only look into when i have to (in principle one > can make all kind of fancy mechanisms but does it pay off ... seldom) If there's no easy solution, it's alright. If have a workaround. No need to waste time on exotic features (as long as masks in external figures keep working). Still, if you happen to know a trick to pull that off in ConTeXt, let me know. Marco ___ 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] Shading and transparency
On 7/11/2018 8:45 PM, Marco Patzer wrote: Hi! It's shadings and transparency again. For most things transparency is not required since the background colour (white) can be used instead, to achieve the same effect (thanks Hans for the reimplementation/cleanup a while ago). For one use case I worked around this by including an external file and overlay the external file (see attached example). Background: In the actual documents the transparent overlays overlay images to have the edges fade into the page background (only the centre is of interest). Is there a method that does not require an external file or pre-processing? Using the external file works. Just wondering if there's a better - more integrated - way. i guess that with some experimenting you can come close but the external file that you use uses masks (actually we do support masks in external figures) and multiple shades over something in the page stream, stuff i'd only look into when i have to (in principle one can make all kind of fancy mechanisms but does it pay off ... seldom) 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 ___
Re: [NTG-context] Shading to transparent using withshademethod
On Thu, 28 Jan 2016 18:26:28 +0100 Hans Hagen wrote: > On 1/28/2016 3:34 PM, Marco Patzer wrote: > > On Thu, 28 Jan 2016 14:45:13 +0100 > > Hans Hagen wrote: > > > >> On 1/28/2016 1:53 PM, Marco Patzer wrote: > >>> On Thu, 28 Jan 2016 12:33:39 +0100 > >>> Hans Hagen wrote: > >>> > >>> How to make transparent shadings work with the new > >>> mechanism? > >> > >> withtransparency (1,.5) > > > > However, this makes the entire shade transparent. How to shade > > from one colour to transparent using withtransparency to achieve > > an effect like in the example below? > > that isn't how shading works, > >>> > >>> …any longer. I just confirmed that it used to work on an older > >>> installation. Just sayin' > >> > >> are you sure? > > > > See the attached example. The shade seems to go from black to fully > > transparent. So regardless of the background colour the shade looks > > fine. I can't replicate this with the new mechanism. > > a matter of choosing the colors Indeed, if you choose the colours wisely you don't necessarily need transparency (at least in my use case). > \unprotect > > \def\MPcoloronly#1% >{\clf_mpcolor > \attribute\colormodelattribute > \colo_helpers_inherited_current_ca{#1} % > \zerocount} > > \def\MPtransparency#1% >{\clf_mpcolor > \zerocount > \zerocount > \colo_helpers_inherited_current_ta{#1} } > > \protect > > \startbuffer >\definecolor[tex:bg][s=.85] >\definecolor[mp:fg] [s=.85,t=1,a=1] >\setupbackgrounds [page] [background=color,backgroundcolor=tex:bg] >\starttext > \contextversion\crlf > \startMPcode > % lightgray = 0.85white; ^^^ That looks more like Tex's lightgray > fill fullsquare xyscaled (12cm, 12cm) > withshademethod "linear" > withshadevector (-1,0) > % withshadecolors (black,lightgray) > % withtransparency (1,1) > withshadecolors (black,\MPcoloronly{mp:fg}) > withtransparency \MPtransparencyonly{mp:fg} ^ Typo or new feature? looks like \MPtransparency should be sufficient > ; > \stopMPcode >\stoptext > \stopbuffer > > \starttext >\typebuffer\getbuffer > \stoptext I'll play with the code in the new beta. Marco ___ 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 ___
Re: [NTG-context] Shading to transparent using withshademethod
On 1/28/2016 3:34 PM, Marco Patzer wrote: On Thu, 28 Jan 2016 14:45:13 +0100 Hans Hagen wrote: On 1/28/2016 1:53 PM, Marco Patzer wrote: On Thu, 28 Jan 2016 12:33:39 +0100 Hans Hagen wrote: How to make transparent shadings work with the new mechanism? withtransparency (1,.5) However, this makes the entire shade transparent. How to shade from one colour to transparent using withtransparency to achieve an effect like in the example below? that isn't how shading works, …any longer. I just confirmed that it used to work on an older installation. Just sayin' are you sure? See the attached example. The shade seems to go from black to fully transparent. So regardless of the background colour the shade looks fine. I can't replicate this with the new mechanism. a matter of choosing the colors \unprotect \def\MPcoloronly#1% {\clf_mpcolor \attribute\colormodelattribute \colo_helpers_inherited_current_ca{#1} % \zerocount} \def\MPtransparency#1% {\clf_mpcolor \zerocount \zerocount \colo_helpers_inherited_current_ta{#1} } \protect \startbuffer \definecolor[tex:bg][s=.85] \definecolor[mp:fg] [s=.85,t=1,a=1] \setupbackgrounds [page] [background=color,backgroundcolor=tex:bg] \starttext \contextversion\crlf \startMPcode % lightgray = 0.85white; fill fullsquare xyscaled (12cm, 12cm) withshademethod "linear" withshadevector (-1,0) % withshadecolors (black,lightgray) % withtransparency (1,1) withshadecolors (black,\MPcoloronly{mp:fg}) withtransparency \MPtransparencyonly{mp:fg} ; \stopMPcode \stoptext \stopbuffer \starttext \typebuffer\getbuffer \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | 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 ___
Re: [NTG-context] Shading to transparent using withshademethod
On 1/28/2016 2:02 PM, Marco Patzer wrote: On Thu, 28 Jan 2016 12:29:46 +0100 Hans Hagen wrote: How to make transparent shadings work with the new mechanism? withtransparency (1,.5) next beta \definecolor [trans] [a=multiply, t=.5, g=.5] \startMPpage fill fullcircle scaled 12cm withcolor \MPcoloronly{trans}; fill fullcircle scaled 10cm withcolor \MPcolor{trans}; fill fullsquare xyscaled (15cm, 15cm) withshademethod "linear" withshadevector (0,1) withshadecolors (red,\MPcoloronly{trans}) withtransparency \MPtransparency{trans} ; \stopMPpage I believe the \MPcoloronly and \MPtransparency macros split up the \MPcolor in it's colour and transparency parts. This doesn't really provide a solution to the initial problem as I understand. Rather it seems to be a more robust way to use transparency and prevent choking on colours that might contain transparent parts. In the old method we used special mp colors to store all kind of things which wasn't 100% robust either (because some colors were not possible then). Even then internally color and transparency had to be split in mp. The new syntax for shading is extensible. You really don't want to know how extensions like shading and tex text and ... were implemented in mkii metapost. I will shade to the background colour then, which is not that clean but works as well. Anyway, thanks for the quick answer and the clarification. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | 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 ___
Re: [NTG-context] Shading to transparent using withshademethod
On Thu, 28 Jan 2016 14:45:13 +0100 Hans Hagen wrote: > On 1/28/2016 1:53 PM, Marco Patzer wrote: > > On Thu, 28 Jan 2016 12:33:39 +0100 > > Hans Hagen wrote: > > > > How to make transparent shadings work with the new mechanism? > > withtransparency (1,.5) > >>> > >>> However, this makes the entire shade transparent. How to shade > >>> from one colour to transparent using withtransparency to achieve > >>> an effect like in the example below? > >> > >> that isn't how shading works, > > > > …any longer. I just confirmed that it used to work on an older > > installation. Just sayin' > > are you sure? See the attached example. The shade seems to go from black to fully transparent. So regardless of the background colour the shade looks fine. I can't replicate this with the new mechanism. Marco t.mkvi Description: Binary data t.pdf Description: Adobe PDF document ___ 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 ___
Re: [NTG-context] Shading to transparent using withshademethod
On 1/28/2016 1:53 PM, Marco Patzer wrote: On Thu, 28 Jan 2016 12:33:39 +0100 Hans Hagen wrote: How to make transparent shadings work with the new mechanism? withtransparency (1,.5) However, this makes the entire shade transparent. How to shade from one colour to transparent using withtransparency to achieve an effect like in the example below? that isn't how shading works, …any longer. I just confirmed that it used to work on an older installation. Just sayin' are you sure? a shade goes from one color to another; transparency is not part of that but applied to the whole (transparency is kind of independent of color and in context also only coupled in definition not in implementation) it's a vector from one color to the other (same color space eventually) and transparency is a property of the whole That's how the new mechanism works, apparently. But transparency can AFAIK also be a property of the colour. So transparency is a vector from one colour to the other, each possibly being partly or entirely transparent. no, it's independent ... and in shades one talks of color spaces (need to be the same too) so in context we even need to make sure an rgb to cmyk shade goes well But as I don't understand the inner internals, I believe there's a good reason this has been changed. cleaner Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | 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 ___
Re: [NTG-context] Shading to transparent using withshademethod
On Thu, 28 Jan 2016 12:29:46 +0100 Hans Hagen wrote: > >> How to make transparent shadings work with the new mechanism? > > > >withtransparency (1,.5) > > next beta > > \definecolor [trans] [a=multiply, t=.5, g=.5] > > \startMPpage > fill fullcircle scaled 12cm withcolor \MPcoloronly{trans}; > fill fullcircle scaled 10cm withcolor \MPcolor{trans}; > > fill fullsquare xyscaled (15cm, 15cm) >withshademethod "linear" >withshadevector (0,1) >withshadecolors (red,\MPcoloronly{trans}) >withtransparency \MPtransparency{trans} > ; > > \stopMPpage I believe the \MPcoloronly and \MPtransparency macros split up the \MPcolor in it's colour and transparency parts. This doesn't really provide a solution to the initial problem as I understand. Rather it seems to be a more robust way to use transparency and prevent choking on colours that might contain transparent parts. I will shade to the background colour then, which is not that clean but works as well. Anyway, thanks for the quick answer and the clarification. Marco ___ 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 ___
Re: [NTG-context] Shading to transparent using withshademethod
On Thu, 28 Jan 2016 12:33:39 +0100 Hans Hagen wrote: > >>> How to make transparent shadings work with the new mechanism? > >> > >> withtransparency (1,.5) > > > > However, this makes the entire shade transparent. How to shade from > > one colour to transparent using withtransparency to achieve an > > effect like in the example below? > > that isn't how shading works, …any longer. I just confirmed that it used to work on an older installation. Just sayin' > it's a vector from one color to the > other (same color space eventually) and transparency is a property of > the whole That's how the new mechanism works, apparently. But transparency can AFAIK also be a property of the colour. So transparency is a vector from one colour to the other, each possibly being partly or entirely transparent. But as I don't understand the inner internals, I believe there's a good reason this has been changed. Marco ___ 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 ___
Re: [NTG-context] Shading to transparent using withshademethod
On 1/28/2016 11:45 AM, Marco Patzer wrote: On Thu, 28 Jan 2016 09:43:24 +0100 Hans Hagen wrote: On 1/27/2016 10:05 PM, Marco Patzer wrote: The new code appears to work in general, but only if no shading to transparent is being used: \definecolor [trans] [a=multiply, t=.5, s=.5] \starttext \startMPcode % works fill fullcircle scaled 10cm withcolor \MPcolor{trans}; fill fullsquare xyscaled (15cm, 15cm) withshademethod "linear" withshadevector (0,1) % works withshadecolors (red,\MPcolor{blue}) % fails %% withshadecolors (red,\MPcolor{trans}) ; \stopMPcode \stoptext How to make transparent shadings work with the new mechanism? withtransparency (1,.5) However, this makes the entire shade transparent. How to shade from one colour to transparent using withtransparency to achieve an effect like in the example below? that isn't how shading works, it's a vector from one color to the other (same color space eventually) and transparency is a property of the whole \definecolor [trans] [a=multiply, t=0] \setupbackgrounds [page] [background=color, backgroundcolor=lightgray] \starttext \startMPcode fill fullsquare xyscaled (15cm, 15cm) withshademethod "linear" withshadevector (0, 1) %% colour doens't match %% withshadecolors (red, lightgray) %% output is ok with \MPcolor withshadecolors (red, \MPcolor{lightgray}) %% ?? %% withtransparency (1, .5) ; \stopMPcode \stoptext Furthermore, why do the tex and MP colours differ? Wouldn't it make sense to use the same colour definitions? Or was that intentional? it's already hard enough to have what we have now (tex and mp are different species) - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | 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 ___
Re: [NTG-context] Shading to transparent using withshademethod
On 1/28/2016 9:43 AM, Hans Hagen wrote: On 1/27/2016 10:05 PM, Marco Patzer wrote: Hi, some months ago the withshading, withfromshadecolor etc. have apparently been replaced by the more general withshademethod, withshadevector, withshadecolors, etc. methods. I have issues converting the old withshading code to the withshademethod version. The old code had no problems shading to transparent: \definecolor [trans] [a=multiply, t=.5, s=.5] \starttext \startMPcode path p; p:=fullsquare xyscaled (8cm, 8cm); fill p withshading("linear", ulcorner p, llcorner p) withfromshadecolor \MPcolor{black} withtoshadecolor \MPcolor{trans}; \stopMPcode \stoptext The new code appears to work in general, but only if no shading to transparent is being used: \definecolor [trans] [a=multiply, t=.5, s=.5] \starttext \startMPcode % works fill fullcircle scaled 10cm withcolor \MPcolor{trans}; fill fullsquare xyscaled (15cm, 15cm) withshademethod "linear" withshadevector (0,1) % works withshadecolors (red,\MPcolor{blue}) % fails %% withshadecolors (red,\MPcolor{trans}) ; \stopMPcode \stoptext How to make transparent shadings work with the new mechanism? withtransparency (1,.5) next beta \definecolor [trans] [a=multiply, t=.5, g=.5] \startMPpage fill fullcircle scaled 12cm withcolor \MPcoloronly{trans}; fill fullcircle scaled 10cm withcolor \MPcolor{trans}; fill fullsquare xyscaled (15cm, 15cm) withshademethod "linear" withshadevector (0,1) withshadecolors (red,\MPcoloronly{trans}) withtransparency \MPtransparency{trans} ; \stopMPpage - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | 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 ___
Re: [NTG-context] Shading to transparent using withshademethod
On Thu, 28 Jan 2016 09:43:24 +0100 Hans Hagen wrote: > On 1/27/2016 10:05 PM, Marco Patzer wrote: > > The new code appears to work in general, but only if no shading to > > transparent is being used: > > > > \definecolor [trans] [a=multiply, t=.5, s=.5] > > \starttext > >\startMPcode > > % works > > fill fullcircle scaled 10cm withcolor \MPcolor{trans}; > > > > fill fullsquare xyscaled (15cm, 15cm) > >withshademethod "linear" > >withshadevector (0,1) > >% works > >withshadecolors (red,\MPcolor{blue}) > >% fails > >%% withshadecolors (red,\MPcolor{trans}) > >; > >\stopMPcode > > \stoptext > > > > How to make transparent shadings work with the new mechanism? > >withtransparency (1,.5) However, this makes the entire shade transparent. How to shade from one colour to transparent using withtransparency to achieve an effect like in the example below? \definecolor [trans] [a=multiply, t=0] \setupbackgrounds [page] [background=color, backgroundcolor=lightgray] \starttext \startMPcode fill fullsquare xyscaled (15cm, 15cm) withshademethod "linear" withshadevector (0, 1) %% colour doens't match %% withshadecolors (red, lightgray) %% output is ok with \MPcolor withshadecolors (red, \MPcolor{lightgray}) %% ?? %% withtransparency (1, .5) ; \stopMPcode \stoptext Furthermore, why do the tex and MP colours differ? Wouldn't it make sense to use the same colour definitions? Or was that intentional? Marco ___ 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 ___
Re: [NTG-context] Shading to transparent using withshademethod
On 1/27/2016 10:05 PM, Marco Patzer wrote: Hi, some months ago the withshading, withfromshadecolor etc. have apparently been replaced by the more general withshademethod, withshadevector, withshadecolors, etc. methods. I have issues converting the old withshading code to the withshademethod version. The old code had no problems shading to transparent: \definecolor [trans] [a=multiply, t=.5, s=.5] \starttext \startMPcode path p; p:=fullsquare xyscaled (8cm, 8cm); fill p withshading("linear", ulcorner p, llcorner p) withfromshadecolor \MPcolor{black} withtoshadecolor \MPcolor{trans}; \stopMPcode \stoptext The new code appears to work in general, but only if no shading to transparent is being used: \definecolor [trans] [a=multiply, t=.5, s=.5] \starttext \startMPcode % works fill fullcircle scaled 10cm withcolor \MPcolor{trans}; fill fullsquare xyscaled (15cm, 15cm) withshademethod "linear" withshadevector (0,1) % works withshadecolors (red,\MPcolor{blue}) % fails %% withshadecolors (red,\MPcolor{trans}) ; \stopMPcode \stoptext How to make transparent shadings work with the new mechanism? withtransparency (1,.5) Marco ___ 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 ___ -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | 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 ___
Re: [NTG-context] shading
On 2011-05-19 Hans Hagen wrote: > On 19-5-2011 12:08, Marco wrote: > > > new commands. I can't figure out how to shade from a > > particular colour to transparent. > > afaik you can't as one shades from color to color (maybe > achoosing nother transparency method) As soon as transparency (the method doesn't matter) is involved, the transparent colour component turns into either black or white (depending on the method). Shading only works well with uniform colours, however the entire path can be made transparent, not the single shading colour components. Best regards Marco ___ 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 ___
Re: [NTG-context] shading
On 19-5-2011 12:08, Marco wrote: new commands. I can't figure out how to shade from a particular colour to transparent. afaik you can't as one shades from color to color (maybe choosing another transparency method) 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 ___
Re: [NTG-context] shading
On 2011-05-18 Hans Hagen wrote: > On 18-5-2011 8:30, Marco wrote: > > > % Error > > % path p; p:=fullsquare scaled 5cm shifted (10cm, 0cm); > > % fill p > > % withshading("linear", llcorner p, urcorner p) > > % withcolor \MPcolor{red-t} shadedinto \MPcolor{blue}; > > don't ask how, but the upcoming beta can handle it > > \starttext > […] Thanks a lot. But I'm still a bit lost in all the new commands. I can't figure out how to shade from a particular colour to transparent. \starttext \definecolor [trans-t] [t=1, a=normal] \startMPpage path p; p:=fullsquare scaled 5cm; fill p withcolor \MPcolor{red}; % Works if background colour is known and uniform path p; p:=fullsquare scaled 3cm; fill p withshading("linear", llcorner p, urcorner p) withcolor \MPcolor{blue} shadedinto \MPcolor{red}; path p; p:=fullsquare scaled 5cm shifted (5cm, 0cm); fill p withcolor \MPcolor{red}; % Shades to white path p; p:=fullsquare scaled 3cm shifted (5cm, 0cm); fill p withshading("linear", llcorner p, urcorner p) withfromshadecolor \MPcolor{blue} withtoshadecolor \MPcolor{trans-t}; \stopMPpage \stoptext Marco ___ 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 ___
Re: [NTG-context] shading
On 18-5-2011 8:30, Marco wrote: % Error % path p; p:=fullsquare scaled 5cm shifted (10cm, 0cm); % fill p % withshading("linear", llcorner p, urcorner p) % withcolor \MPcolor{red-t} shadedinto \MPcolor{blue}; don't ask how, but the upcoming beta can handle it \starttext \definecolor [red-t] [r=1,t=.6,a=1] \definecolor [blue-t] [b=1,t=.4,a=1] \startMPpage path p ; p := fullsquare scaled 6cm ; fill p ; path p ; p := fullsquare scaled 6cm shifted (-4cm,-4cm); fill p withshading("linear", llcorner p, urcorner p) withcolor \MPcolor{red} shadedinto \MPcolor{blue} ; path p ; p := fullsquare scaled 6cm shifted (4cm,4cm) ; fill p withshading("linear", llcorner p, urcorner p) withcolor \MPcolor{red} shadedinto \MPcolor{blue} withtransparency(1,.5) ; path p ; p := fullsquare scaled 6cm shifted (-4cm,4cm) ; fill p withshading("linear", llcorner p, urcorner p) withcolor \MPcolor{red} shadedinto \MPcolor{blue-t}; path p ; p := fullsquare scaled 6cm shifted (4cm,-4cm) ; fill p withshading("linear", llcorner p, urcorner p) withcolor \MPcolor{blue-t} shadedinto \MPcolor{red}; % withfromshadecolor \MPcolor{blue-t} withtoshadecolor \MPcolor{red}; \stopMPpage \stoptext - 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 ___
Re: [NTG-context] shading
On 18-5-2011 8:55, Henning Hraban Ramm wrote: Am 2011-05-18 um 20:30 schrieb Marco: For this metafun has been extended with a few more shading commands, with the nicest being: […] Very nice these commands! I like them. But the shadings in MP still have problems with transparency. Example below. I guess, it's not supported. If not, are you planing to add it or is it unlikely? Transparency, combined with spot colors and gradients, is really tricky. Maybe not so much in MP, but at least in InDesign you must know how you export your PDFs to get expected and printable (i.e. color separable) results. Hans, do you need another example? no, transparency does not relate to shades (i.e. is not part of the shading function) 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 ___
Re: [NTG-context] shading
On 18-5-2011 8:30, Marco wrote: % The entire square is transparent, % not just the shading part path p; p:=fullsquare scaled 5cm shifted (5cm, 0cm); fill p withshading("linear", llcorner p, urcorner p) withcolor \MPcolor{red} shadedinto \MPcolor{blue-t}; indeed, as transparency is independent of shading % Error % path p; p:=fullsquare scaled 5cm shifted (10cm, 0cm); % fill p % withshading("linear", llcorner p, urcorner p) % withcolor \MPcolor{red-t} shadedinto \MPcolor{blue}; for the moment use withfromshadecolor ... (i need to discuss the other variant with taco as it involves the mp parser) 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 ___
Re: [NTG-context] shading
Am 2011-05-18 um 20:30 schrieb Marco: For this metafun has been extended with a few more shading commands, with the nicest being: […] Very nice these commands! I like them. But the shadings in MP still have problems with transparency. Example below. I guess, it's not supported. If not, are you planing to add it or is it unlikely? Transparency, combined with spot colors and gradients, is really tricky. Maybe not so much in MP, but at least in InDesign you must know how you export your PDFs to get expected and printable (i.e. color separable) results. Hans, do you need another example? Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer) ___ 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 ___
Re: [NTG-context] shading
> For this metafun has been extended with a few more > shading commands, with the nicest being: > […] Very nice these commands! I like them. But the shadings in MP still have problems with transparency. Example below. I guess, it's not supported. If not, are you planing to add it or is it unlikely? \starttext \definecolor [red-t] [r=1, t=.6, a=normal] \definecolor [blue-t] [b=1, t=.4, a=normal] \startMPpage % Works path p; p:=fullsquare scaled 5cm; fill p withshading("linear", llcorner p, urcorner p) withcolor \MPcolor{red} shadedinto \MPcolor{blue}; % The entire square is transparent, % not just the shading part path p; p:=fullsquare scaled 5cm shifted (5cm, 0cm); fill p withshading("linear", llcorner p, urcorner p) withcolor \MPcolor{red} shadedinto \MPcolor{blue-t}; % Error % path p; p:=fullsquare scaled 5cm shifted (10cm, 0cm); % fill p % withshading("linear", llcorner p, urcorner p) % withcolor \MPcolor{red-t} shadedinto \MPcolor{blue}; \stopMPpage \stoptext Marco ___ 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 ___
Re: [NTG-context] shading in metapost
Thomas A. Schmitz wrote: > I never thanked you for your message; sorry about that! Unless I'm > missing something, this page is just about transparency, but that > works quite well in metafun; it was the combination of transparency > and shading which I couldn't get right. in mkiv at some point this may work because there transparency and color are separated, but there will be no changes to metafun till mplib is around Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] shading in metapost
On Jan 24, 2008, at 9:03 AM, Aditya Mahajan wrote: > Hi Thomas, > > On Thu, 24 Jan 2008, Thomas A. Schmitz wrote: >> >> I wanted to be clever and do it in a >> for-loop like this: >> >> for i=1 upto 10: >> pickup pencircle scaled (i*0.5) pt ; >> draw fullcircle scaled 5mm withcolor transparent (1,0.04,black) ; >> endfor ; >> >> Is this because the expression "pencircle scaled" expects a "numeric >> primary" as argument? And is there any way around this? > > scaled expects a dimension. (i*0.5)pt is not a dimension. You need to > either write (i*0.5pt) or ((i*0.5)*1pt). The extra parenthesis are > needed > to keep the metapost parser happy. > > Aditya > Hi Aditya, agh. So easy - and I had no idea how to do it. Works perfectly! I'm glad I'm in the humanities and not in engineering; my bridges would collapse real soon... Thanks so much; this loop looks so much nicer than having ten lines of code doing the same circle all over again! All best Thomas ___ 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] shading in metapost
Hi Thomas, On Thu, 24 Jan 2008, Thomas A. Schmitz wrote: > On Jan 24, 2008, at 1:28 AM, Mojca Miklavec wrote: >> >> In theory possible, but in practice not implemented in metafun. But >> see >>http://www.fauskes.net/media/pgf/pgfmanualCVS2008-01-23.pdf >> It might satisfy your needs. (Impressive!) >> >> Mojca > > Thanks, Mojca, that's what I suspected. For the time being, I prefer > metafun just because I know a little bit about it (and almost nothing > about tikz). TikZ has a nice interface. The only drawback right now is the speed. Hopefully sometime in the near future, some of the backend of tikz will be written in lua and mplib, which will make things much faster. > I have solved the problem at hand by drawing ten > instances of a very transparent black circle on top of each other and > increasing the scale of the pencircle slightly at every run. Which > leads me to one last question: I wanted to be clever and do it in a > for-loop like this: > > for i=1 upto 10: > pickup pencircle scaled (i*0.5) pt ; > draw fullcircle scaled 5mm withcolor transparent (1,0.04,black) ; > endfor ; > > Is this because the expression "pencircle scaled" expects a "numeric > primary" as argument? And is there any way around this? scaled expects a dimension. (i*0.5)pt is not a dimension. You need to either write (i*0.5pt) or ((i*0.5)*1pt). The extra parenthesis are needed to keep the metapost parser happy. 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] shading in metapost
On Jan 16, 2008, at 11:22 PM, John Luciani wrote: > There is some information on doing transparencies in > METAPOST at http://www-math.univ-poitiers.fr/~phan/metalpha.html > > Using the code at the above link you should be able to produce > the effect in your jpeg. > > (* jcl *) John, I never thanked you for your message; sorry about that! Unless I'm missing something, this page is just about transparency, but that works quite well in metafun; it was the combination of transparency and shading which I couldn't get right. On Jan 24, 2008, at 1:28 AM, Mojca Miklavec wrote: > > In theory possible, but in practice not implemented in metafun. But > see >http://www.fauskes.net/media/pgf/pgfmanualCVS2008-01-23.pdf > It might satisfy your needs. (Impressive!) > > Mojca Thanks, Mojca, that's what I suspected. For the time being, I prefer metafun just because I know a little bit about it (and almost nothing about tikz). I have solved the problem at hand by drawing ten instances of a very transparent black circle on top of each other and increasing the scale of the pencircle slightly at every run. Which leads me to one last question: I wanted to be clever and do it in a for-loop like this: for i=1 upto 10: pickup pencircle scaled (i*0.5) pt ; draw fullcircle scaled 5mm withcolor transparent (1,0.04,black) ; endfor ; Is this because the expression "pencircle scaled" expects a "numeric primary" as argument? And is there any way around this? All best, and thanks to all Thomas ___ 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] shading in metapost
On Jan 16, 2008 8:07 PM, Thomas A. Schmitz wrote: > Hi all, > > I have a somewhat silly question about metapost/metafun. To emphasize > parts of a picture, I place a bright red arrow or circle/ellipse on > top of the picture. I would like to make this arrow more visible by > putting a shade beneath it (I attach a jpg that will hopefully show > the desired effect). Right now, I simply draw the arrow twice with a > transparent black color, once with a smaller pencircle, so the effect > is like a shadow that is darker in the center than at the edges. > However, I think the effect would be more dramatic if I could have a > transparent area with a smooth grading. Is this possible at all in > metapost? filling a path with a transparent AND shaded color? In theory possible, but in practice not implemented in metafun. But see http://www.fauskes.net/media/pgf/pgfmanualCVS2008-01-23.pdf It might satisfy your needs. (Impressive!) 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] shading in metapost
There is some information on doing transparencies in METAPOST at http://www-math.univ-poitiers.fr/~phan/metalpha.html Using the code at the above link you should be able to produce the effect in your jpeg. (* jcl *) -- http://www.luciani.org ___ 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] shading with stitching functions
Mojca Miklavec wrote: > On 12/27/06, Peter Rolf wrote: >> Hi Mojca, >> >> this is also on my wishlist (and christmas is over). Currently I use >> several color gradients in a row, to simulate the same effect. But sadly >> this way is too viewer dependent (rendering is a matter of luck with >> every new version), not to mention the big size. So if there would be a >> cleaner solution, I would be a happy man. >> >> I'm willing to help, but I haven't looked into specials yet. Give me >> some time for reading and some more time for understanding... ;) > > With Hans's hint I finally got some kind of result. However, the > numbers in the stream seem to influence the colors, but not in the way > I want them to. I have to do some further explorations. Does anyone > know how to convert PS to PDF without compression? > I used \pdfcompresslevel=0 with your example code. > Btw: TikZ supports such shadings, so if you don't necessary need a > metapost graphic, you can take a look at it as well. Here's an example >>from the manual: > I need them as mp graphic, but it shouldn't hurt to look into that. > \usemodule[tikz] > \starttext > \pgfdeclarehorizontalshading{myshadingA} > {1cm}{rgb(0cm)=(1,0,0); color(2cm)=(green); color(4cm)=(blue)} > \pgfuseshading{myshadingA} > \stoptext > > (I've just found out that it uses another aproach for "sampled > functions", perhaps I'll have more chances to figure out how to > implement it that way.) > > Mojca > ___ > ntg-context mailing list > ntg-context@ntg.nl > http://www.ntg.nl/mailman/listinfo/ntg-context > ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading with stitching functions
On 12/27/06, Peter Rolf wrote: > Hi Mojca, > > this is also on my wishlist (and christmas is over). Currently I use > several color gradients in a row, to simulate the same effect. But sadly > this way is too viewer dependent (rendering is a matter of luck with > every new version), not to mention the big size. So if there would be a > cleaner solution, I would be a happy man. > > I'm willing to help, but I haven't looked into specials yet. Give me > some time for reading and some more time for understanding... ;) With Hans's hint I finally got some kind of result. However, the numbers in the stream seem to influence the colors, but not in the way I want them to. I have to do some further explorations. Does anyone know how to convert PS to PDF without compression? Btw: TikZ supports such shadings, so if you don't necessary need a metapost graphic, you can take a look at it as well. Here's an example from the manual: \usemodule[tikz] \starttext \pgfdeclarehorizontalshading{myshadingA} {1cm}{rgb(0cm)=(1,0,0); color(2cm)=(green); color(4cm)=(blue)} \pgfuseshading{myshadingA} \stoptext (I've just found out that it uses another aproach for "sampled functions", perhaps I'll have more chances to figure out how to implement it that way.) Mojca ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading with stitching functions
Hi Mojca, this is also on my wishlist (and christmas is over). Currently I use several color gradients in a row, to simulate the same effect. But sadly this way is too viewer dependent (rendering is a matter of luck with every new version), not to mention the big size. So if there would be a cleaner solution, I would be a happy man. I'm willing to help, but I haven't looked into specials yet. Give me some time for reading and some more time for understanding... ;) Greetings, Peter Mojca Miklavec wrote: > Hello, > > I'm still trying to get shading in MetaPost as the one in the attached > eps file, but I don't manage to decipher the way how other shandings > are done. > > There's a .tex file attached with a failed (hardcoded) example tries > ... but I don't know where to explore further. > > I would appreciate any hints, > Mojca > > > > > ___ > ntg-context mailing list > ntg-context@ntg.nl > http://www.ntg.nl/mailman/listinfo/ntg-context ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading with stitching functions
Mojca Miklavec wrote: > Hello, > > I'm still trying to get shading in MetaPost as the one in the attached > eps file, but I don't manage to decipher the way how other shandings > are done. > > There's a .tex file attached with a failed (hardcoded) example tries > but I don't know where to explore further. well, 'where' coul dbe spec-tpd, or the pdftex manual -) {\immediate\pdfobj stream attr {/FunctionType 0 /Order 1 /BitsPerSample 8 /Domain [\gMPs1 \gMPs2] /Decode [ 0 1 0 1 0 1 ] /Range [ 0 1 0 1 0 1 ] /Size [ 11 ]} {00 00 00 51 00 96 71 02 f3 8c 07 f3 a1 10 96 b4 20 00 c6 37 00 d5 57 00 e4 83 00 f2 ba 00 ff ff 00}% you can try to define a stream but then you also must maks sure that there is a corresponding length key Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading box many times
Vit Zyka wrote: yes, it works! Now it works even on my old distrib also. Seems the crutial line was inside this vardef: vardef add_special_signal = % write the version number if (length _global_specials_ <> 0) or (length _local_specials_ <> 0) : special ("%%MetaPostSpecials: 2.0 " & decimal _special_signal_ & " " & decimal _special_div_) ; fi ; enddef ; indeed, i pass the value to the mp to pdf converter so that old files still work ok; otherwise we get a truckload of compatibility problems Hans ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading box many times
Hans Hagen wrote: Vit Zyka wrote: Hans Hagen wrote: Taco Hoekwater wrote: Hans Hagen wrote: Vit Zyka wrote: Dear Metafun Wizards, I have noticed some strange behaviour with box shading. It works OK until some number of shadings. Please see example: http://typokvitek.com/tmp/shade-many.pdf Any idea for solving? Next not-minimal but small and illustrative example can help. works ok here; since it concerns independent mp runs, i cannot imagine what goes wrong; mayeb a bad random numer; does your log say something? My results are the same as Vit's example: The last 9 items are not shaded but have 3 black sides and 1 white one (with \write18 disabled, using a single \jobname-mpgraph.mp) I don't know what is going, but at least I can reproduce the problem. it's related to the fact that there can be 1000 specials only (this /1000 in mp-spec) if you add: \def\MPrgbnumber#1{\expandafter\doMPrgbnumber#1.0\relax} \def\doMPrgbnumber#1.#2#3#4#5#6\relax{#2#3#4#5} \startMPinclusions _special_div_ := 1 ; \stopMPinclusions to the file, and change all 1000's in mp-spec.tex into _special_div_ it works ok; so, the question (for taco is): does mp have the right Really? Hmmm, not for me. I have got the graphics with flat color per picture; every picture in the sequence has lighter and lighter color (starting from black). (After performing your instructions in the mp-spec.mp and refreshing metafun.mem.) can you try the experimental zip i posted yesterday (.../temp/cont-tmf.zip) forget about the definitions, just set \settrue \manyMPspecials in your file should work > > Hans yes, it works! Now it works even on my old distrib also. Seems the crutial line was inside this vardef: vardef add_special_signal = % write the version number if (length _global_specials_ <> 0) or (length _local_specials_ <> 0) : special ("%%MetaPostSpecials: 2.0 " & decimal _special_signal_ & " " & decimal _special_div_) ; fi ; enddef ; Again many thanks, Hans Vit ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading box many times
Vit Zyka wrote: Hans Hagen wrote: Taco Hoekwater wrote: Hans Hagen wrote: Vit Zyka wrote: Dear Metafun Wizards, I have noticed some strange behaviour with box shading. It works OK until some number of shadings. Please see example: http://typokvitek.com/tmp/shade-many.pdf Any idea for solving? Next not-minimal but small and illustrative example can help. works ok here; since it concerns independent mp runs, i cannot imagine what goes wrong; mayeb a bad random numer; does your log say something? My results are the same as Vit's example: The last 9 items are not shaded but have 3 black sides and 1 white one (with \write18 disabled, using a single \jobname-mpgraph.mp) I don't know what is going, but at least I can reproduce the problem. it's related to the fact that there can be 1000 specials only (this /1000 in mp-spec) if you add: \def\MPrgbnumber#1{\expandafter\doMPrgbnumber#1.0\relax} \def\doMPrgbnumber#1.#2#3#4#5#6\relax{#2#3#4#5} \startMPinclusions _special_div_ := 1 ; \stopMPinclusions to the file, and change all 1000's in mp-spec.tex into _special_div_ it works ok; so, the question (for taco is): does mp have the right Really? Hmmm, not for me. I have got the graphics with flat color per picture; every picture in the sequence has lighter and lighter color (starting from black). (After performing your instructions in the mp-spec.mp and refreshing metafun.mem.) can you try the experimental zip i posted yesterday (.../temp/cont-tmf.zip) forget about the definitions, just set \settrue \manyMPspecials in your file should work Hans ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading box many times
Hans Hagen wrote: Taco Hoekwater wrote: Hans Hagen wrote: Vit Zyka wrote: Dear Metafun Wizards, I have noticed some strange behaviour with box shading. It works OK until some number of shadings. Please see example: http://typokvitek.com/tmp/shade-many.pdf Any idea for solving? Next not-minimal but small and illustrative example can help. works ok here; since it concerns independent mp runs, i cannot imagine what goes wrong; mayeb a bad random numer; does your log say something? My results are the same as Vit's example: The last 9 items are not shaded but have 3 black sides and 1 white one (with \write18 disabled, using a single \jobname-mpgraph.mp) I don't know what is going, but at least I can reproduce the problem. it's related to the fact that there can be 1000 specials only (this /1000 in mp-spec) if you add: \def\MPrgbnumber#1{\expandafter\doMPrgbnumber#1.0\relax} \def\doMPrgbnumber#1.#2#3#4#5#6\relax{#2#3#4#5} \startMPinclusions _special_div_ := 1 ; \stopMPinclusions to the file, and change all 1000's in mp-spec.tex into _special_div_ it works ok; so, the question (for taco is): does mp have the right Really? Hmmm, not for me. I have got the graphics with flat color per picture; every picture in the sequence has lighter and lighter color (starting from black). (After performing your instructions in the mp-spec.mp and refreshing metafun.mem.) -- \def\MPrgbnumber#1{\expandafter\doMPrgbnumber#1.0\relax} \def\doMPrgbnumber#1.#2#3#4#5#6\relax{#2#3#4#5} \startMPinclusions _special_div_ := 1 ; \stopMPinclusions \startuseMPgraphic{F} def log(expr Xstart, Xstop)= begingroup save x, y, D, w, P; pair D; path P; w := 2.5pt; w := w/2; D := unitvector(Xstop-Xstart) rotated 90; z1 = Xstart shifted (w*D); z2 = Xstop shifted (w*D); z3 = Xstop shifted (-w*D); z4 = Xstart shifted (-w*D); P := z1--z2{z2-z1}..{z4-z3}z3--z4{z4-z3}..{z2-z1}cycle; P endgroup enddef; path P; x11 = 0; x12 = \overlaywidth; y11 = y12 = \overlayheight; P:= log(z11,z12); linear_shade(P,8,(1,1,1),(0,0,0)); draw P; \stopuseMPgraphic \defineoverlay[F][\uniqueMPgraphic{F}] \defineframed[F][offset=2mm,strut=yes,background=F,frame=off] \starttext \noindent\dorecurse{1000}{\F{\recurselevel} } \stoptext -- precission (it looks ok to me, unless we need to start calculating with it) so, it may be a dangerous patch. I'll adapt spec-mp to this new constant but for the moment keep the 1 in my cont-loc file Hans ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context -- === Ing. Vít Zýka, Ph.D. TYPOkvítek database publishing databazove publikovani data maintaining and typesetting in typographic quality priprava dat a jejich sazba v typograficke kvalite tel.: (+420) 777 198 189 www: http://typokvitek.com === ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading box many times
Vit Zyka wrote: > Taco Hoekwater wrote: >> Hans Hagen wrote: >> >>> Vit Zyka wrote: >>> Dear Metafun Wizards, I have noticed some strange behaviour with box shading. It works OK until some number of shadings. Please see example: http://typokvitek.com/tmp/shade-many.pdf Any idea for solving? Next not-minimal but small and illustrative example can help. >>> >>> >>> works ok here; since it concerns independent mp runs, i cannot >>> imagine what goes wrong; mayeb a bad random numer; does your log say >>> something? >> >> >> My results are the same as Vit's example: The last 9 items are >> not shaded but have 3 black sides and 1 white one >> (with \write18 disabled, using a single \jobname-mpgraph.mp) >> >> I don't know what is going, but at least I can reproduce the problem. >> I'm attaching an example wrong image. >> >> Taco > > A minimal version is here. It shows the randomization is not the reason. > Shade disappears at 989th shade. Both examples work here (win xp). pdfeTeX, Version 3.141592-1.30.4-20050924-2.2 (Web2C 7.5.5) ConTeXt ver: 2005.11.16 fmt: 2005.11.17 int: english mes: german MetaPost, Version 0.901 (Web2c 7.5.3) Peter ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading box many times
Taco Hoekwater wrote: Whether or not that makes dividing by 10.000 safe is not clear to me. I have to read up on what is going on first. for i=1 upto 1 : show i/1 ; endfor ; indicates that indeed the precision is ok i put a version for testing purposes at www.pragma-ade.com/temp/cont-tmf.zip \settrue \manyMPspecials will permit 10K specials (it also has GB's desparate prefix patch so he'd better test it -) Hans ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading box many times
Hans Hagen wrote: it's related to the fact that there can be 1000 specials only (this /1000 in mp-spec) Why? if you add: \def\MPrgbnumber#1{\expandafter\doMPrgbnumber#1.0\relax} \def\doMPrgbnumber#1.#2#3#4#5#6\relax{#2#3#4#5} \startMPinclusions _special_div_ := 1 ; \stopMPinclusions to the file, and change all 1000's in mp-spec.tex into _special_div_ it works ok; so, the question (for taco is): does mp have the right precission (it looks ok to me, unless we need to start calculating with it) I am not sure what you are doing, but ... in general the fractional part of a dimension in TeX, divided by an integer, maps to an identical fraction (of a bp) in metapost, since both use the same 16-bit (% 65536) calculus algorithm. Same quantity, different unit. Whether or not that makes dividing by 10.000 safe is not clear to me. I have to read up on what is going on first. Taco ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading box many times
Taco Hoekwater wrote: Hans Hagen wrote: Vit Zyka wrote: Dear Metafun Wizards, I have noticed some strange behaviour with box shading. It works OK until some number of shadings. Please see example: http://typokvitek.com/tmp/shade-many.pdf Any idea for solving? Next not-minimal but small and illustrative example can help. works ok here; since it concerns independent mp runs, i cannot imagine what goes wrong; mayeb a bad random numer; does your log say something? My results are the same as Vit's example: The last 9 items are not shaded but have 3 black sides and 1 white one (with \write18 disabled, using a single \jobname-mpgraph.mp) I don't know what is going, but at least I can reproduce the problem. it's related to the fact that there can be 1000 specials only (this /1000 in mp-spec) if you add: \def\MPrgbnumber#1{\expandafter\doMPrgbnumber#1.0\relax} \def\doMPrgbnumber#1.#2#3#4#5#6\relax{#2#3#4#5} \startMPinclusions _special_div_ := 1 ; \stopMPinclusions to the file, and change all 1000's in mp-spec.tex into _special_div_ it works ok; so, the question (for taco is): does mp have the right precission (it looks ok to me, unless we need to start calculating with it) so, it may be a dangerous patch. I'll adapt spec-mp to this new constant but for the moment keep the 1 in my cont-loc file Hans ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading box many times
Taco Hoekwater wrote: Hans Hagen wrote: Vit Zyka wrote: Dear Metafun Wizards, I have noticed some strange behaviour with box shading. It works OK until some number of shadings. Please see example: http://typokvitek.com/tmp/shade-many.pdf Any idea for solving? Next not-minimal but small and illustrative example can help. works ok here; since it concerns independent mp runs, i cannot imagine what goes wrong; mayeb a bad random numer; does your log say something? My results are the same as Vit's example: The last 9 items are not shaded but have 3 black sides and 1 white one (with \write18 disabled, using a single \jobname-mpgraph.mp) I don't know what is going, but at least I can reproduce the problem. I'm attaching an example wrong image. Taco A minimal version is here. It shows the randomization is not the reason. Shade disappears at 989th shade. === \startuseMPgraphic{F} def log(expr Xstart, Xstop)= begingroup save x, y, D, w, P; pair D; path P; w := 2.5pt; w := w/2; D := unitvector(Xstop-Xstart) rotated 90; z1 = Xstart shifted (w*D); z2 = Xstop shifted (w*D); z3 = Xstop shifted (-w*D); z4 = Xstart shifted (-w*D); P := z1--z2{z2-z1}..{z4-z3}z3--z4{z4-z3}..{z2-z1}cycle; P endgroup enddef; path P; x11 = 0; x12 = \overlaywidth; y11 = y12 = \overlayheight; P:= log(z11,z12); linear_shade(P,8,(1,1,1),(0,0,0)); draw P; \stopuseMPgraphic \defineoverlay[F][\uniqueMPgraphic{F}] \defineframed[F][offset=2mm,strut=yes,background=F,frame=off] \starttext \noindent\dorecurse{1000}{\F{\recurselevel} } \stoptext ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading box many times
Hans Hagen wrote: Vit Zyka wrote: Dear Metafun Wizards, I have noticed some strange behaviour with box shading. It works OK until some number of shadings. Please see example: http://typokvitek.com/tmp/shade-many.pdf Any idea for solving? Next not-minimal but small and illustrative example can help. works ok here; since it concerns independent mp runs, i cannot imagine what goes wrong; mayeb a bad random numer; does your log say something? Hans Hmmm strange, the second similar result in last two days: wrong result also on wiki. My log says (whole log is attached) systems : randomizer starts with 981406338 Vit This is pdfeTeXk, Version 3.141592-1.21b-2.2 (Web2C 7.5.4) (format=cont-en 2005.11.24) 28 NOV 2005 13:56 entering extended mode \write18 enabled. %&-line parsing enabled. (c:/TeXLive/texmf-experim2/web2c/natural.tcx) **&cont-en shade-many.tex (./shade-many.tex ConTeXt ver: 2005.09.08 fmt: 2005.11.24 int: english mes: english language: language en is active system : cont-new loaded (c:/TeXLive/texmf-experim2/tex/context/base/cont-new.tex systems : beware: some patches loaded from cont-new.tex color : palette rollover is available ) system : cont-old loaded (c:/TeXLive/texmf-experim2/tex/context/base/cont-old.tex loading : Context Old Macros ) system : cont-fil loaded (c:/TeXLive/texmf-experim2/tex/context/base/cont-fil.tex loading : Context File Synonyms ) system : cont-sys loaded (c:/TeXLive/texmf-experim2/tex/context/user/cont-sys.tex (c:/TeXLive/texmf-experim2/tex/context/base/type-exa.tex) (c:/TeXLive/texmf-experim2/tex/context/base/type-syn.tex) (c:/TeXLive/texmf-experim2/tex/context/base/type-enc.tex) (c:/TeXLive/texmf-experim2/tex/context/base/type-dis.tex) (c:/TeXLive/texmf-experim2/tex/context/base/type-siz.tex) (c:/TeXLive/texmf-experim2/tex/context/base/type-map.tex) (c:/TeXLive/texmf-experim2/tex/context/base/type-spe.tex) (c:/TeXLive/texmf-experim2/tex/context/base/type-akb.tex)) bodyfont: 12pt rm is loaded language: patterns en->ec:ec->1->2:2 uk->ec:ec->2->2:2 de->texnansi:tex nansi->3->2:2 de->ec:ec->4->2:2 fr->texnansi:texnansi->5->2:2 fr->ec:ec->6->2:2 es->ec:ec->7->2:2 pt->texnansi:texnansi->8->2:2 pt->ec:ec->9->2:2 it->texnansi :texnansi->10->2:2 it->ec:ec->11->2:2 nl->texnansi:texnansi->12->2:2 nl->ec:ec- >13->2:2 cz->il2:il2->14->2:2 cz->ec:ec->15->2:2 sk->il2:il2->16->2:2 sk->ec:ec ->17->2:2 pl->pl0:pl0->18->2:2 pl->ec:ec->19->2:2 pl->qx:qx->20->2:2 loaded specials: tex,postscript,rokicki loaded \openout2 = `shade-many.tui'. system : shade-many.top loaded (./shade-many.top specials: loading definition file tpd (c:/TeXLive/texmf-experim2/tex/context/base/spec-tpd.tex specials: loading definition file fdf (c:/TeXLive/texmf-experim2/tex/context/base/spec-fdf.tex) specials: fdf loaded ) specials: fdf,tpd loaded ) \openout0 = `shade-many-mpgraph.mp'. \openout0 = `mpgraph.mp'. (./shade-many.tuo) (./shade-many.tuo) (./shade-many.tuo) (./shade-many.tuo) (./shade-many.tuo) (./shade-many.tuo) (./shade-many.tuo) (./shade-many.tuo) (./shade-many.tuo) (./shade-many.tuo) (./shade-many.tuo) (./shade-many.tuo) (./shade-many.tuo) systems : begin file shade-many at line 56 \openout5 = `shade-many-mpgraph.mp'. systems : randomizer starts with 981406338 [MP to PDF] (./shade-many-mpgraph.4000) [MP to PDF] (./shade-many-mpgraph.3999) [MP to PDF] (./shade-many-mpgraph.3998) [MP to PDF] (./shade-many-mpgraph.3997) [MP to PDF] (./shade-many-mpgraph.3996) [MP to PDF] (./shade-many-mpgraph.3995) [MP to PDF] (./shade-many-mpgraph.3994) [MP to PDF] (./shade-many-mpgraph.3993) [MP to PDF] (./shade-many-mpgraph.3992) [MP to PDF] (./shade-many-mpgraph.3991) [MP to PDF] (./shade-many-mpgraph.3990) [MP to PDF] (./shade-many-mpgraph.3989) [MP to PDF] (./shade-many-mpgraph.3988) [MP to PDF] (./shade-many-mpgraph.3987) [MP to PDF] (./shade-many-mpgraph.3986) [MP to PDF] (./shade-many-mpgraph.3985) [MP to PDF] (./shade-many-mpgraph.3984) [MP to PDF] (./shade-many-mpgraph.3983) [MP to PDF] (./shade-many-mpgraph.3982) [MP to PDF] (./shade-many-mpgraph.3981) [MP to PDF] (./shade-many-mpgraph.3980) [MP to PDF] (./shade-many-mpgraph.3979) [MP to PDF] (./shade-many-mpgraph.3978) [MP to PDF] (./shade-many-mpgraph.3977) [MP to PDF] (./shade-many-mpgraph.3976) [MP to PDF] (./shade-many-mpgraph.3975) [MP to PDF] (./shade-many-mpgraph.3974) [MP to PDF] (./shade-many-mpgraph.3973) [MP to PDF] (./shade-many-mpgraph.3972) [MP to PDF] (./shade-many-mpgraph.3971) [MP to PDF] (./shade-many-mpgraph.3970) [MP to PDF] (./shade-many-mpgraph.3969) [MP to PDF] (./shade-many-mpgraph.3968) [MP to PDF] (./shade-many-mpgraph.3967) [MP to PDF] (./shade-many-mpgraph.3966) [MP to PDF] (./shade-many-mpgraph.3965) [MP to PDF] (./shade-many-mpgraph.3964) [MP to PDF] (./shade-many-mpgraph.3963) [MP to PDF] (./shade-many-mpgraph.3962) [MP to PDF] (./s
Re: [NTG-context] shading box many times
Hans Hagen wrote: Vit Zyka wrote: Dear Metafun Wizards, I have noticed some strange behaviour with box shading. It works OK until some number of shadings. Please see example: http://typokvitek.com/tmp/shade-many.pdf Any idea for solving? Next not-minimal but small and illustrative example can help. works ok here; since it concerns independent mp runs, i cannot imagine what goes wrong; mayeb a bad random numer; does your log say something? My results are the same as Vit's example: The last 9 items are not shaded but have 3 black sides and 1 white one (with \write18 disabled, using a single \jobname-mpgraph.mp) I don't know what is going, but at least I can reproduce the problem. I'm attaching an example wrong image. Taco vitmp-mpgraph.3745 Description: PostScript document ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading box many times
Vit Zyka wrote: Dear Metafun Wizards, I have noticed some strange behaviour with box shading. It works OK until some number of shadings. Please see example: http://typokvitek.com/tmp/shade-many.pdf Any idea for solving? Next not-minimal but small and illustrative example can help. works ok here; since it concerns independent mp runs, i cannot imagine what goes wrong; mayeb a bad random numer; does your log say something? Hans ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading in meta[post/play] & PDF
Page 746 of PDF Reference, version 1.6 also defines an interesting new feature: 3D objects (3D Artwork as they call it), but I haven't found anything else about that. there is a section about shading, the function numbers differ; ? How? (I was talking only about shading types, not about function types at all anyway, but the number *should* be the same.) take a look at supp-mpe.tex, all we need is some variant on \defineMPspecial{31} {\startMPshading{16}% type 3 \setMPshadingcolors{4}{5}{6}{10}{11}{12}% \immediate\pdfobj {<>}% \immediate\pdfobj {<>}% \stopMPshading} (plus some more depending on what parameters need to be passed) Thanks for pointing it out. This piece of code is very nice (however the whole bunch of code that resides in the file ... I wonder how you managed to put all that stuff together :) > if you can locate the right stuff in the pdf ref manual we can see what can be done (off list); i can add more 'special' handlers to the mp to pdf converted Here are some more examples: http://partners.adobe.com/public/developer/ps/sdk/index_archive.html http://partners.adobe.com/public/developer/en/ps/sdk/TN5600.SmoothShading.pdf http://partners.adobe.com/public/developer/en/ps/sdk/sample/smooth.zip (I didn't want to send the material to the list and I didn't find the links until now.) I'll try to make the drawings I need (in PostScript for the beginning) and collect the ideas of how the things have to be implemented (which features supported and how). I'm in no way such a 'superwoman' to be able to do dozens of things efficiently in one day as you do, but I'll do my best; exams are approaching, so it may take me slightly longer - please apologize me. Thanks again for being prepared to help. I'll write back as soon as I have something to report. Mojca ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading in meta[post/play] & PDF
Mojca Miklavec wrote: Problem description: I have a computer program, which carries the data about the grid points on a sphere (possibly with different colors defined in these points) and how the points are connected with each other to form a grid. I would take these triangles (or quadrilaterals), draw them transformed on the plane (with curves, not with straight lines) and fill them with the appropriate shading pattern (colors defined in corners of the triangles (darker according to normal vector) simply interpolated between the three points). Yet another possibility would probably be to use function-based shading and define a function which knows how the points have to be shaded on the sphere, but the latter seems more complicated and less universal. Problem reduction: Fill a mp closed path with any more complex shading. So I would probably need Type 6 or 7 shading (Type 4 would be OK as the picture can be clipped within metapost, so that the resulting sphere borders are not composed of straight lines; the articles on http://www.math.ubc.ca/people/faculty/cass/graphics/text/www/ which inspired me to do something so crazy actually use Type 4 shading). Type one is probably the most general one, so it should be OK too, just complicated to do. However: I'm not sure if, say, a (sampled) function to be passed to PDF can be specified in metapost elegantly. i searched my machine extensively but it seems that i lost some code that could be used as starting point for that; Page 746 of PDF Reference, version 1.6 also defines an interesting new feature: 3D objects (3D Artwork as they call it), but I haven't found anything else about that. there is a section about shading, the function numbers differ; In dvipdfm there's an example of using: \special{pdf: bt rotate 90 xscale 2.0 } These lines are to be used in TeX. MetaPost also knows a "special" command, I just don't know how to use it. (This is probably the "communication channel" to PDF when trying to implement some more exotic shadings.) take a look at supp-mpe.tex, all we need is some variant on \defineMPspecial{31} {\startMPshading{16}% type 3 \setMPshadingcolors{4}{5}{6}{10}{11}{12}% \immediate\pdfobj {<>}% \immediate\pdfobj {<>}% \stopMPshading} (plus some more depending on what parameters need to be passed) I glimpsed the mp-spec.mp file, but I didn't yet understand how the parameters are passed to PDF. [more a context mailing list issue than a metapost list issue] So I left the metapost group out. Actually, 90% on the people here probably think I posted that to the wrong group anyway (in the sense of "Are you sure you didn't want to post that question to the 3D studio max mailing list?" :) The example above is probably not the most descriptive one, but having the possibility to add some more advanced shading patterns would be great. if you can locate the right stuff in the pdf ref manual we can see what can be done (off list); i can add more 'special' handlers to the mp to pdf converted Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] shading in meta[post/play] & PDF
Hans Hagen wrote: Mojca Miklavec wrote: How can I make shading inside metapost(play) to produce exactly what's in the attached picture (smooth shades). Or more generally: how can I "hardcode" some PS/PDF code in .mp, not (yet) supported by metapost(play)? certain kind of native level 2 shaded can be done with the metafun macros (circular and linear vector based) a couple of years ago mathew baker and i played with more advanced features using functions and such but i need to locate that code; if you're willing to figure out what (in pdf) functionality is needed i can extend the current metapost shading handler with a few more alternatives [the function based ones, since that's what you're looking for]) I'm not sure if I understood the question correctly (about what should I figure out). I would like to draw a sphere (possibly with different colors on different points of the sphere; which would then be interpolated across the whole surface). Problem description: I have a computer program, which carries the data about the grid points on a sphere (possibly with different colors defined in these points) and how the points are connected with each other to form a grid. I would take these triangles (or quadrilaterals), draw them transformed on the plane (with curves, not with straight lines) and fill them with the appropriate shading pattern (colors defined in corners of the triangles (darker according to normal vector) simply interpolated between the three points). Yet another possibility would probably be to use function-based shading and define a function which knows how the points have to be shaded on the sphere, but the latter seems more complicated and less universal. Problem reduction: Fill a mp closed path with any more complex shading. So I would probably need Type 6 or 7 shading (Type 4 would be OK as the picture can be clipped within metapost, so that the resulting sphere borders are not composed of straight lines; the articles on http://www.math.ubc.ca/people/faculty/cass/graphics/text/www/ which inspired me to do something so crazy actually use Type 4 shading). Type one is probably the most general one, so it should be OK too, just complicated to do. However: I'm not sure if, say, a (sampled) function to be passed to PDF can be specified in metapost elegantly. Page 746 of PDF Reference, version 1.6 also defines an interesting new feature: 3D objects (3D Artwork as they call it), but I haven't found anything else about that. In dvipdfm there's an example of using: \special{pdf: bt rotate 90 xscale 2.0 } These lines are to be used in TeX. MetaPost also knows a "special" command, I just don't know how to use it. (This is probably the "communication channel" to PDF when trying to implement some more exotic shadings.) I glimpsed the mp-spec.mp file, but I didn't yet understand how the parameters are passed to PDF. [more a context mailing list issue than a metapost list issue] So I left the metapost group out. Actually, 90% on the people here probably think I posted that to the wrong group anyway (in the sense of "Are you sure you didn't want to post that question to the 3D studio max mailing list?" :) The example above is probably not the most descriptive one, but having the possibility to add some more advanced shading patterns would be great. Thank you, Mojca ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Shading transparency / missing linear_shade variant
Eckhart Guthöhrlein wrote: On Tue, Jul 27, 2004 at 01:37:06PM +0200, Hans Hagen wrote: But anyway, transparency is ignored when using shading. Is there any possibility to achieve a gradient from, i.e., completely transparent to completely intransparent white? no(t yet), i dunno if pdf supports that -) That's really a pity. But alas, if *you* don't know, it's probably hopeless. the problem is in the fact that in a shading one has to define a vector and i have to find out how to define a transparent vector (color 1 -> color 2) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ ntg-context mailing list [EMAIL PROTECTED] http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Shading transparency / missing linear_shade variant
On Tue, Jul 27, 2004 at 01:37:06PM +0200, Hans Hagen wrote: > >But anyway, transparency is ignored when using shading. Is there any > >possibility to achieve a gradient from, i.e., completely transparent to > >completely intransparent white? > > > > > no(t yet), i dunno if pdf supports that -) That's really a pity. But alas, if *you* don't know, it's probably hopeless. -- Eckhart ___ ntg-context mailing list [EMAIL PROTECTED] http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Shading transparency / missing linear_shade variant
Eckhart Guthöhrlein wrote: On Sat, Jul 24, 2004 at 11:36:03AM +0200, Vit Zyka wrote: Furthermore, the shading variants for linear_shade do not correspond with those listed in the metafun manual, page 180. Variant 2 is missing and behaves like variant 3 should. Not so exactly. The today reality is a bit richer than that in the Metafun manual. One can choose from 8 directions: number direction 1NE 2NW 3SW 4SE 5E 6N 7W 8S otherE All right, thanks. Admittedly, i could have found this by trying more numbers. But anyway, transparency is ignored when using shading. Is there any possibility to achieve a gradient from, i.e., completely transparent to completely intransparent white? no(t yet), i dunno if pdf supports that -) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ ntg-context mailing list [EMAIL PROTECTED] http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Shading transparency / missing linear_shade variant
On Sat, Jul 24, 2004 at 11:36:03AM +0200, Vit Zyka wrote: > >Furthermore, the shading variants for linear_shade do not correspond > >with those listed in the metafun manual, page 180. Variant 2 is missing > >and behaves like variant 3 should. > > Not so exactly. The today reality is a bit richer than that in the > Metafun manual. One can choose from 8 directions: > > number direction > 1NE > 2NW > 3SW > 4SE > 5E > 6N > 7W > 8S > otherE All right, thanks. Admittedly, i could have found this by trying more numbers. But anyway, transparency is ignored when using shading. Is there any possibility to achieve a gradient from, i.e., completely transparent to completely intransparent white? -- Eckhart ___ ntg-context mailing list [EMAIL PROTECTED] http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Shading transparency / missing linear_shade variant
Furthermore, the shading variants for linear_shade do not correspond with those listed in the metafun manual, page 180. Variant 2 is missing and behaves like variant 3 should. Not so exactly. The today reality is a bit richer than that in the Metafun manual. One can choose from 8 directions: number direction 1NE 2NW 3SW 4SE 5E 6N 7W 8S otherE Vit Zyka ___ ntg-context mailing list [EMAIL PROTECTED] http://www.ntg.nl/mailman/listinfo/ntg-context