[metapost] metafun: transparency (opacity) that doesn't add up

Stephan Hennig mailing_list at arcor.de
Tue Apr 25 00:35:31 CEST 2006


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);
  endfor
endfig;
end


%%% Process this code via mpost and mptopdf.


More information about the metapost mailing list