As I only use one transparency method anyway I could also fix this by passing a numeric instead of a pair and use the standard withtransparency (I don’t like overriding a standard MetaFun method, one never knows what might break in future updates). vardef Foo( expr w, h, fillColor, fillTransparency) = show "FOO:", w, h, fillColor, fillTransparency; save pic; picture pic; save circ; path circ; circ := (fullcircle xyscaled (h,h)); pic := image ( fill (circ shifted (w-h/2,-h/2)) withcolor fillColor withtransparency (1,fillTransparency); ); pic enddef; picture pic; pic := Foo( 150, 50, (0.686,1.000,1.000), 0.5); draw pic; \stopMPpage \stoptext > On 9 Apr 2020, at 18:06, Hans Hagen wrote: > > On 4/9/2020 4:58 PM, Gerben Wierda wrote: >> \starttext >> \startMPpage[instance=doublefun] >> vardef Foo( expr w, h, fillColor, fillTransparency) = >> show "FOO:", w, h, fillColor, fillTransparency; >> save pic; picture pic; >> save circ; path circ; >> circ := (fullcircle xyscaled (h,h)); >> pic := image ( >> fill (circ shifted (w-h/2,-h/2)) withcolor fillColor withtransparency fillTransparency; >> ); >> pic >> enddef; >> pic := Foo( 150, 50, (0.686,1.000,1.000), (1,1.000)); >> draw pic; >> \stopMPpage >> \stoptext > > Maybe this definition is better then but I need to test it more > > \starttext > \startMPpage[instance=doublefun] > > def withtransparency expr t = > if pair t : > withprescript "tr_alternative=" & decimal transparency_alternative_to_number(xpart t) > withprescript "tr_transparency=" & decimal ypart t > else : > mfun_with_transparency (transparency_alternative_to_number(t)) > fi > enddef ; > > def mfun_with_transparency (expr a) expr t = > withprescript "tr_alternative=" & decimal a > withprescript "tr_transparency=" & decimal t > enddef ; > > vardef Foo ( expr w, h, fillColor, fillTransparency) = > image ( > fill fullcircle xyscaled (h,h) shifted (w-h/2,-h/2) > withcolor fillColor > withtransparency fillTransparency > ; > ) > enddef; > > vardef FooX ( expr w, h, fillColor) = > image ( > fill fullcircle xyscaled (h,h) shifted (w-h/2,-h/2) > withcolor fillColor > withtransparency (normaltransparent, .5) > ; > ) > enddef; > > vardef FooY ( expr w, h, fillColor) = > image ( > fill fullcircle xyscaled (h,h) shifted (w-h/2,-h/2) > withcolor fillColor > withtransparency normaltransparent .5 > ; > ) > enddef; > > draw Foo ( 350, 50, (0.5,1,0), (1,.5)); > draw FooX ( 250, 50, (1,0.5,1)); > draw FooY ( 150, 50, (1,1,0.5)); > > \stopMPpage > \stoptext > > > -- > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl > -----------------------------------------------------------------