ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Metafun : reuse a static picture
@ 2024-11-24 22:43 Fabrice L
  0 siblings, 0 replies; only message in thread
From: Fabrice L @ 2024-11-24 22:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,

	I have some difficulty to reuse a static picture in a multipage MetaFun document. I wish to define a complex image, with graphic and texts, and manipulate this image at each page. As the minimal working example shows, if I define a particular picture in the variable « AnImage » and a random text in another picture called « AnotherImage », I can use these two pictures in the first page of the document, but only one of them appears in the second page of the document (with the same code). I know that if I replace startMPinclusions/stopMPinclusions by startMPinitializations/stopMPinitializations, this works, but the image is recalculated (a different number is drawn), and I do not want this since the image is complex and takes time to make. 

	So the question : how to make the two pictures « AnImage » and « AnotherImage » appears in the both page ?
	Thanks for any help !
	Fabrice,

% MWE :
% 8< ---------------------------------------
\starttext

\startMPinclusions
	picture AnImage , AnotherImage;
	AnImage := image (
	  draw fullcircle scaled 40;
	);
	AnotherImage := image (
	  arandomnumber := uniformdeviate(1);
	  draw textext(decimal(arandomnumber)) scaled 0.5;
	);
\stopMPinclusions

\startMPpage
	draw AnImage ;
	draw AnotherImage ;
\stopMPpage

\startMPpage
	draw AnImage ;
	draw AnotherImage ;
\stopMPpage
\stoptext
% 8< ---------------------------------------


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-11-24 22:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-24 22:43 [NTG-context] Metafun : reuse a static picture Fabrice L

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).