From: DesdeChaves <desdechaves@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Strange output from linear_shade (METAPOST)
Date: Sat, 15 Feb 2014 00:15:15 +0000 [thread overview]
Message-ID: <CAPBmU9EbPYh0RZnwuVTKghQifoQYQ6r7vxjfBn3OcDv2qOBgeA@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1198 bytes --]
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
[-- Attachment #1.2: Type: text/html, Size: 1832 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
reply other threads:[~2014-02-15 0:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPBmU9EbPYh0RZnwuVTKghQifoQYQ6r7vxjfBn3OcDv2qOBgeA@mail.gmail.com \
--to=desdechaves@gmail.com \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).