I have refactored my code to use withtransparency and separate parameters for 
colors, sizes, transparency, etc. But I’m running into a problem. The 
fillTransparency parameter is a pair primary (as can be seen from the show 
command)

Here is a pretty minimum example (in reality there are multiple colors and 
transparencies passed on):

\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

and the result is:

metapost log    > >> "FOO:"
metapost log    > >> 150
metapost log    > >> 50
metapost log    > >> (0.68600000000000005,1,1)
metapost log    > >> (1,1)
metapost log    > ! Missing argument to withtransparency.
metapost log    > <to be read again> 
metapost log    >                    ((1,1))
metapost log    > <argument> ...0000005,1,1))withtransparency((1,1))
metapost log    >                                                   ;
metapost log    > image->...ture;currentpicture:=nullpicture;(TEXT3)
metapost log    >                                                   
;currentpicture.if.str(SUF...
metapost log    > 
metapost log    > Foo->...)withcolor(EXPR4)withtransparency(EXPR5);)
metapost log    >                                                   
;pic.endgroup
metapost log    > <*> ...o( 150, 50, (0.686,1.000,1.000), (1,1.000))
metapost log    >                                                   ; draw pic; 
;

What am I doing wrong here?

Thanks,

G

PS. Given the complaint about asking both here and on tex.stackexchange, which 
of the two is the best place?
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to