[NTG-context] Shading to transparent using withshademethod

Hans Hagen pragma at wxs.nl
Thu Jan 28 12:29:46 CET 2016


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
-----------------------------------------------------------------


More information about the ntg-context mailing list