summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/meta-imp-dum.mkiv
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2019-07-31 18:26:52 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2019-07-31 18:26:52 +0200
commit1873d112b56f49e40ece29916ede51933412bca8 (patch)
tree1ad98a73dfbf2f1a98703f31e0df9e0cdf4f260c /tex/context/base/mkiv/meta-imp-dum.mkiv
parent47852e5715e7c0374bb6bc173c1728908549e1ed (diff)
downloadcontext-1873d112b56f49e40ece29916ede51933412bca8.tar.gz
2019-07-31 18:13:00
Diffstat (limited to 'tex/context/base/mkiv/meta-imp-dum.mkiv')
-rw-r--r--tex/context/base/mkiv/meta-imp-dum.mkiv127
1 files changed, 64 insertions, 63 deletions
diff --git a/tex/context/base/mkiv/meta-imp-dum.mkiv b/tex/context/base/mkiv/meta-imp-dum.mkiv
index b84d4ac7a..457de4b35 100644
--- a/tex/context/base/mkiv/meta-imp-dum.mkiv
+++ b/tex/context/base/mkiv/meta-imp-dum.mkiv
@@ -30,69 +30,70 @@
%D
%D \typebuffer \getbuffer
-% currently preparempvariables is unable to resolve number
-% fractions like reduction
-
-% June 22, 2003, this definition was patched to adapt itself
-% to transparent colors, but ... in 2011 we no longer have
-% is_transparent so we revert.
-%
-% \startuseMPgraphic{placeholder}{width,height,reduction,color}
-% numeric w, h, d, r ; color c, b, cc ; path p ; boolean t ;
-% t := is_transparent(\MPvar{color}) ;
-% c := not_transparent(\MPvar{color}) ;
-% b := not_transparent(white) ;
-% w := \MPvar{width} ;
-% h := \MPvar{height} ;
-% r := \MPvar{reduction} ;
-% d := max(w,h) ;
-% p := unitsquare xyscaled (w,h) ;
-% cc := r[.5c,b] ;
-% fill p withcolor if t : transparent(1,.5,cc) else : cc fi ;
-% for i := 1 upto 60 :
-% cc := r[c randomized(.3,.9),b] ;
-% fill fullcircle
-% scaled (d/5 randomized (d/5))
-% shifted (center p randomized (d))
-% withcolor if t : transparent(1,.5,cc) else : cc fi ;
-% endfor ;
-% clip currentpicture to p ;
-% \stopuseMPgraphic
-
-\startuseMPgraphic{minifun::figure:placeholder}{width,height,reduction,color}
- begingroup ;
- save w, h, d, r, p, c, b ;
- numeric w, h, d, r ; path p ;
- if cmykcolor \MPvar{color} :
- cmykcolor c, b ; b := (0,0,0,0)
- else :
- color c, b ; b := (1,1,1)
- fi ;
- c := \MPvar{color} ;
- w := \MPvar{width} ;
- h := \MPvar{height} ;
- r := \MPvar{reduction} ;
- d := max(w,h) ;
- p := unitsquare xyscaled (w,h) ;
- fill p withcolor r[.5c,b] ;
- for i := 1 upto 60 :
- fill fullcircle
- scaled (d/5 randomized (d/5))
- shifted (center p randomized (d))
- withcolor r[c randomized(.3,.9),b] ;
- endfor ;
- clip currentpicture to p ;
- endgroup ;
-\stopuseMPgraphic
-
-\defineoverlay
- [figure:placeholder:graphic]
- [\useMPgraphic
- {minifun::figure:placeholder}%
- {width=\figurewidth,%
- height=\figureheight,%
- reduction=\externalfigureparameter\c!reduction,%
- color=placeholder:\the\c_grph_replacement_n}] % weird, why do we need to prefix the palette
+\startmkivmode
+
+%D Currently preparempvariables is unable to resolve number fractions like
+%D reduction.
+
+ \startuseMPgraphic{minifun::figure:placeholder}{width,height,reduction,color}
+ begingroup ;
+ save w, h, d, r, p, c, b ;
+ numeric w, h, d, r ; path p ;
+ if cmykcolor \MPvar{color} :
+ cmykcolor c, b ; b := (0,0,0,0)
+ else :
+ color c, b ; b := (1,1,1)
+ fi ;
+ c := \MPvar{color} ;
+ w := \MPvar{width} ;
+ h := \MPvar{height} ;
+ r := \MPvar{reduction} ;
+ d := max(w,h) ;
+ p := unitsquare xyscaled (w,h) ;
+ fill p withcolor r[.5c,b] ;
+ for i := 1 upto 60 :
+ fill fullcircle
+ scaled (d/5 randomized (d/5))
+ shifted (center p randomized (d))
+ withcolor r[c randomized(.3,.9),b] ;
+ endfor ;
+ clip currentpicture to p ;
+ endgroup ;
+ \stopuseMPgraphic
+
+ \defineoverlay
+ [figure:placeholder:graphic]
+ [\useMPgraphic
+ {minifun::figure:placeholder}%
+ {width=\figurewidth,%
+ height=\figureheight,%
+ reduction=\externalfigureparameter\c!reduction,%
+ color=placeholder:\the\c_grph_replacement_n}] % weird, why do we need to prefix the palette
+
+\stopmkivmode
+
+\startlmtxmode
+
+ \defineMPparameterset
+ [placeholder]
+ [width=dimension,
+ height=dimension,
+ reduction=number,
+ color=string,
+ alternative=string]
+
+ \defineoverlay
+ [figure:placeholder:graphic]
+ [{\useMPmacro
+ [minifun]%
+ [placeholder]%
+ [width=\figurewidth,%
+ height=\figureheight,%
+ alternative=\externalfigureparameter\c!alternative,
+ reduction=\externalfigureparameter\c!reduction,%
+ color=placeholder:\the\c_grph_replacement_n]}]
+
+\stoplmtxmode
\definepalet
[placeholder]