From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/86283 Path: news.gmane.org!not-for-mail From: DesdeChaves Newsgroups: gmane.comp.tex.context Subject: Strange output from linear_shade (METAPOST) Date: Sat, 15 Feb 2014 00:15:15 +0000 Message-ID: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2067939391==" X-Trace: ger.gmane.org 1392423327 30613 80.91.229.3 (15 Feb 2014 00:15:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Feb 2014 00:15:27 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Feb 15 01:15:37 2014 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WESus-0006xQ-Bo for gctc-ntg-context-518@m.gmane.org; Sat, 15 Feb 2014 01:15:34 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 57924101E2; Sat, 15 Feb 2014 01:15:33 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id oBNe4UfUAPMQ; Sat, 15 Feb 2014 01:15:31 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 7DA45101E6; Sat, 15 Feb 2014 01:15:31 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 6FAC0101E6 for ; Sat, 15 Feb 2014 01:15:29 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id njazY3XdiG36 for ; Sat, 15 Feb 2014 01:15:28 +0100 (CET) Original-Received: from filter3-ams.mf.surf.net (filter3-ams.mf.surf.net [192.87.102.71]) by balder.ntg.nl (Postfix) with ESMTP id C001D101E2 for ; Sat, 15 Feb 2014 01:15:17 +0100 (CET) Original-Received: from mail-oa0-x236.google.com (mail-oa0-x236.google.com [IPv6:2607:f8b0:4003:c02::236]) by filter3-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id s1F0FF2L013414 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Sat, 15 Feb 2014 01:15:16 +0100 Original-Received: by mail-oa0-f54.google.com with SMTP id i4so15327170oah.41 for ; Fri, 14 Feb 2014 16:15:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=8XyekrHP1qKF88ztsF7gtxDWqw+jwDowOS5CWSQWUIE=; b=L8LfSQvhBGnjMiXhgh8Ih0vxiRi7mt46wZEkkMefjb9Q6LdIE64FRiQr+Q7Ck4GyZm vsYaEG8Mh1ZloKfqmzr7t4oDfT9itlCHe7dIW5jXszYk5g4WE+B+lSgKQ0+scGd1YShh 4f48go8YRWnwWjmirz2rHmhjmxYt6Nr4gw/jEhdSo2EH4qpm2kvPYmXRUMVQz/ePIYSp 7t3lb47oy4ASPWuON2Gu6OUA0AWY2aCsr8Wq4QAc8zcQy0KYputNgBzW+I25QpzLN0NR e1fR+CqC+XpMeq4PJctwgVIwb+2a3aBPqzvykN2jU4lvEES8pC+Oeq677SF76a4DmA1M 3Zbw== X-Received: by 10.60.131.141 with SMTP id om13mr108096oeb.68.1392423315154; Fri, 14 Feb 2014 16:15:15 -0800 (PST) Original-Received: by 10.60.121.73 with HTTP; Fri, 14 Feb 2014 16:15:15 -0800 (PST) X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=2607:f8b0:4003:c02::236; country=US X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 03LqofgBz - 9e9ca55ae967 - 20140215 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 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-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:86283 Archived-At: --===============2067939391== Content-Type: multipart/alternative; boundary=047d7b471dda13ad6304f266d103 --047d7b471dda13ad6304f266d103 Content-Type: text/plain; charset=ISO-8859-1 I need to create some graphics to teach energy. One of the illustrations is about the sound energy that I represent using linear_shade function. In the following example the first illustration is represented correctly, but the second call of the function SoundEnergy implies the loss of gradient. What am I doing wrong? Thanks in advance Jorge \startMPinclusions def SoundEnergy = path pr ; pr := unitsquare xscaled .3cm yscaled 2cm ; currentpicture:=nullpicture; for i=0 step 2 until 10: linear_shade(pr shifted (i*.3cm,0),0,white,black); linear_shade(pr shifted ((i+1)*.3cm,0),0,black,white); endfor; clip currentpicture to (0,0)--(0,2cm)--(2cm,2cm)--(3cm,1cm)--(2cm,0)--cycle; draw (0,0)--(0,2cm)--(2cm,2cm)--(3cm,1cm)--(2cm,0)--cycle withcolor .625red; addto finalpicture also currentpicture shifted(avanco*3.5cm,0) ; currentpicture := nullpicture ; avanco := avanco+1 ; enddef; \stopMPinclusions \starttext \startMPcode picture finalpicture ; finalpicture := nullpicture ; numeric avanco ; avanco := 0 ; bboxmargin := 0pt ; %% first call is OK SoundEnergy; %% second call loss the gradient SoundEnergy; currentpicture := finalpicture ; \stopMPcode \stoptext --047d7b471dda13ad6304f266d103 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I need to create some graphics to teach energy. One o= f the illustrations is about the sound energy that I represent using linear= _shade function. In the following example the first illustration is represe= nted correctly, but the second call of the function SoundEnergy implies the= loss of gradient. What am I doing wrong?

Thanks in advance

Jorge
<= div>
\startMPinclusions

def SoundEne= rgy =3D

=A0path pr ; pr :=3D unitsquare xscaled .3= cm yscaled 2cm ;
=A0currentpicture:=3Dnullpicture;

=A0for i=3D= 0 step 2 until 10:
=A0 =A0linear_shade(pr shifted (i*.3cm,0),0,wh= ite,black);
=A0 =A0linear_shade(pr shifted ((i+1)*.3cm,0),0,black= ,white);
=A0endfor; =A0

=A0clip currentpicture to (0,0= )--(0,2cm)--(2cm,2cm)--(3cm,1cm)--(2cm,0)--cycle;

= =A0draw (0,0)--(0,2cm)--(2cm,2cm)--(3cm,1cm)--(2cm,0)--cycle withcolor .625= red;=A0
=A0addto finalpicture also currentpicture shifted(avanco*3.5cm,0) ;
=A0currentpicture :=3D nullpicture ; avanco :=3D avanco+1 ; =A0 =A0= =A0
enddef;
\stopMPinclusions

=
\starttext



\sta= rtMPcode

picture finalpicture ; finalpicture :=3D = nullpicture ;
numeric avanco ; avanco :=3D 0 ; bboxmargin :=3D 0p= t ;

%% first call is OK
SoundEnergy;
%% second call loss the gradient
SoundEnergy;
<= div>

currentpicture :=3D finalpicture ;

\stopMPcode


\st= optext

--047d7b471dda13ad6304f266d103-- --===============2067939391== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --===============2067939391==--