Hello (Hans),
this minimal example worked OK in mkiv back in May (most of settings
in the code below are just unimportant cosmetics, but otherwise it's
difficult to explain the idea behind); now it still works in mkii, but
not in mkiv.
\def\mynextmpgraphic{\startMPinclusions erase_picture := 1; \stopMPinclusions}
\startusableMPgraphic{bubble}
if erase_picture = 0:
draw last_picture;
else:
% draw a new picture; in mkiv this code is only reached once,
% \mynextgraphic does not reset erase_picture
fi;
\stopusableMPgraphic
The code is ugly anyway, I know, but how should I reset variables to
redraw the picture once more?
Thanks a lot,
Mojca
---
\setupcolors[state=start]
\definecolor[color 1][r=.7,g=.0,b=.0]
\definecolor[color 2][r=.7,g=.35,b=.0]
\definecolor[color 3][r=.67,g=.7,b=.0]
\definecolor[color 4][r=.3,g=.7,b=.0]
\definecolor[color 5][r=.0,g=.7,b=.0]
\definecolor[color 6][r=.0,g=.7,b=.4]
\definecolor[color 7][r=.0,g=.6,b=.7]
\definecolor[color 8][r=.0,g=.3,b=.7]
\definecolor[color 9][r=.1,g=.0,b=.7]
\definecolor[color 10][r=.4,g=.0,b=.7]
\definecolor[pagecolor][color 1]
\setuphead
[section]
[number=no,
page=yes,
style=\bfd,
color=pagecolor]
\setuppapersize
[S6][S6]
\setuppagenumbering
[location=]
\definelayer
[page]
[width=\paperwidth,
height=\paperheight]
\setupbackgrounds
[page]
[background=bubble]
\defineoverlay
[bubble]
[\useMPgraphic{bubble}]
\startMPinclusions
picture last_picture;
last_picture := nullpicture;
erase_picture := 1;
\stopMPinclusions
\startusableMPgraphic{bubble}
if erase_picture = 0:
draw last_picture;
else:
for i=1 upto 20:
path p; p := fullcircle
scaled (2cm+uniformdeviate(3cm))
shifted (uniformdeviate(\overlaywidth),uniformdeviate(\overlayheight));
fill p withcolor .2[white,\MPcolor{pagecolor}];
draw p withcolor .5[white,\MPcolor{pagecolor}];
endfor;
setbounds currentpicture to unitsquare xyscaled
(\overlaywidth,\overlayheight);
last_picture := currentpicture;
erase_picture := 0;
fi;
\stopusableMPgraphic
\def\mynextmpgraphic{\startMPinclusions erase_picture := 1; \stopMPinclusions}
\starttext
\section{abc first time}
\section{abc second time}
\section{abc third time}
\page\definecolor[pagecolor][color 2]\mynextmpgraphic\page
\section{def first time}
\section{def second time}
\section{def third time}
\page\definecolor[pagecolor][color 3]\mynextmpgraphic\page
\section{ghi first time}
\section{ghi second time}
\page\definecolor[pagecolor][color 4]\mynextmpgraphic\page
\section{jkl first time}
\section{jkl second time}
\section{jkl third time}
\section{jkl fourth time}
\stoptext
___
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 : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___