[NTG-context] Shading to transparent using withshademethod

Marco Patzer lists at homerow.info
Wed Jan 27 22:05:32 CET 2016


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?

Marco


More information about the ntg-context mailing list