[metapost] metafun: transparency (opacity) that doesn't add up
Mojca Miklavec
mojca.miklavec.lists at gmail.com
Tue Apr 25 01:22:42 CEST 2006
On 4/25/06, Stephan Hennig wrote:
> Hi,
>
> in a transparent grid I want to avoid the effect of opacity adding up at
> crossing points. This may sound strange and in some sense contradict the
> notion of transparency. However, the grid should be transparent with
> respect to other material that is drawn below it. In fact the grid and
> the other material are built as independent graphics that are both
> included from a LaTeX document (processed via pdflatex).
>
> For the grid I've tried all twelve transparency methods mentioned in the
> metafun manual, but couldn't find a suitable one. Is there any way to
> draw a uniformly colored transparent grid with MetaFun?
>
> Regards,
> Stephan Hennig
>
>
> input metafun
> beginfig(1);
> string method[];
> method0 = "normal";
> method1 = "multiply";
> method2 = "screen";
> method3 = "overlay";
> method4 = "softlight";
> method5 = "hardlight";
> method6 = "colordodge";
> method7 = "colorburn";
> method8 = "darken";
> method9 = "lighten";
> method10 = "difference";
> method11 = "exclusion";
> pickup pencircle scaled 20bp;
> for i=0 upto 11:
> drawoptions(
> shifted (150 * (i mod 4), 150 * (i div 4))
> withcolor transparent(method[i], .1, black)
> );
> draw (0,0)--(100,100);
> draw (0,100)--(100,0);
Draw a single closed curve instead:
draw (50,50)--(0,0)--(100,100)--(50,50)--(0,100)--(100,0)--cycle;
For two separate curves you'll always get colors adding up to opacity.
Mojca
> endfor
> endfig;
> end
More information about the metapost
mailing list