From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/106810 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Gerben Wierda Newsgroups: gmane.comp.tex.context Subject: METAPOST/MetaFun withtransparency doesn't accept my pair primary argument, what am I doing wrong? Date: Thu, 9 Apr 2020 16:58:04 +0200 Message-ID: <7CC08AA6-0447-4EF3-A04C-62BC8248A309@rna.nl> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Content-Type: multipart/mixed; boundary="===============4728346951017154764==" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="120580"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Apr 09 16:58:22 2020 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jMYdJ-000VFg-VL for gctc-ntg-context-518@m.gmane-mx.org; Thu, 09 Apr 2020 16:58:21 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 39AEC1831F8; Thu, 9 Apr 2020 16:58:08 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QeN14Se4HPBs; Thu, 9 Apr 2020 16:58:07 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 48C6C1831F1; Thu, 9 Apr 2020 16:58:07 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 4364A1831C1 for ; Thu, 9 Apr 2020 16:58:06 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0fpPx8qtF5jD for ; Thu, 9 Apr 2020 16:58:05 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=213.125.118.53; helo=mail.rna.nl; envelope-from=gerben.wierda@rna.nl; receiver= Original-Received: from mail.rna.nl (mail.rna.nl [213.125.118.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id EE8D01809A9 for ; Thu, 9 Apr 2020 16:58:04 +0200 (CEST) Original-Received: from hermione.rna.nl (hermione.rna.nl [192.168.2.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.rna.nl (Postfix) with ESMTPSA id 558653D0C198 for ; Thu, 9 Apr 2020 16:58:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rna.nl; s=dkim_rsa2048; t=1586444284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=XpnKCJ3C0MzRf04ibcNh4AnXIooNl7Kqbul/Yx3mGuY=; b=mkQLFHJfgc83idBg9y2UOJhY0VJEXPKWm5Curnf4fjaueWZjAfnDrp7rIf8/uzGW7q4GX1 zLaO7hAcHg3KG9uNskLQ3Z63NhcAN9XZdLBZenDU8M2we6kbgm5RN/NDipQdWgppuTb+ox 3MH/IOuer3V/Wz8wq4/50N0q7mQk0TVxInyMuV8F6fvh6sSGSk0SCEhLnMvdrvbLEOOhs1 ihvrxWsW1vMllvyWnGEwDTRxwuqrkk7PgMObxLKjcAPXIMpTi5MRoMz1MEsl680o9ecRCn pDp3UCcdqVk6jkcEr1vtiV78VyFyxVgxivOGK37beWZ95USG8r+fLipqouRzTg== X-Mailer: Apple Mail (2.3445.104.14) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:106810 Archived-At: --===============4728346951017154764== Content-Type: multipart/alternative; boundary="Apple-Mail=_D4E66A03-B54B-4126-AA91-C36ED91FB55E" --Apple-Mail=_D4E66A03-B54B-4126-AA91-C36ED91FB55E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 I have refactored my code to use withtransparency and separate = parameters for colors, sizes, transparency, etc. But I=E2=80=99m 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=3Ddoublefun] vardef Foo( expr w, h, fillColor, fillTransparency) =3D show "FOO:", w, h, fillColor, fillTransparency; save pic; picture pic; save circ; path circ; circ :=3D (fullcircle xyscaled (h,h)); pic :=3D image ( fill (circ shifted (w-h/2,-h/2)) withcolor fillColor = withtransparency fillTransparency; ); pic enddef; pic :=3D 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 > =20 metapost log > ((1,1)) metapost log > ...0000005,1,1))withtransparency((1,1)) metapost log > ; metapost log > image->...ture;currentpicture:=3Dnullpicture;(TEXT3) metapost log > = ;currentpicture.if.str(SUF... metapost log >=20 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?= --Apple-Mail=_D4E66A03-B54B-4126-AA91-C36ED91FB55E Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 I = have refactored my code to use withtransparency and separate parameters = for colors, sizes, transparency, etc. But I=E2=80=99m 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=3Ddoublefun]

vardef Foo( expr w, h, fillColor, fillTransparency) = =3D
  show = "FOO:", w, h, fillColor, fillTransparency;
  save pic; picture = pic;
  save = circ; path circ;
  circ = :=3D (fullcircle xyscaled (h,h));
  pic :=3D image (
    fill (circ shifted (w-h/2,-h/2)) = withcolor fillColor withtransparency = fillTransparency;
  );
  pic
enddef;

pic :=3D 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:=3Dnullpicture;(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?
= --Apple-Mail=_D4E66A03-B54B-4126-AA91-C36ED91FB55E-- --===============4728346951017154764== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============4728346951017154764==--