Vit Zyka vit.zyka at seznam.cz
Mon Nov 28 10:02:18 CET 2005

Dear Metafun Wizards,

I have noticed some strange behaviour with box shading. It works OK
Any idea for solving? Next not-minimal but small and illustrative
example can help.

Vit

--------------------------------------------------------------------
\def\Log#1{%
def log(expr Xstart, Xstop)=
begingroup
save x, y, D, w, P;
pair D;
path P;
w := #1; w := w/2;
D := unitvector(Xstop-Xstart) rotated 90;
z1 = Xstart shifted (w*D);
z2 = Xstop shifted (w*D);
z3 = Xstop shifted (-w*D);
z4 = Xstart shifted (-w*D);
P := z1--z2{z2-z1}..{z4-z3}z3--z4{z4-z3}..{z2-z1}cycle;
P
endgroup
enddef;
}
\def\ObdobiFrame#1#2{%
def Rand(expr b) =
(.5pt*(floor(uniformdeviate (2*b+1))-b))
enddef;

path P;
xBor := \overlaylinewidth;
yBor := #1;  yCor := 0pt;
x11 = x14 = 0;
x12 = x13 = \overlaywidth;
y11 = y31 = \overlayheight-yBor+yCor + Rand(2*#2);
y12 = y32 = \overlayheight-yBor+yCor + Rand(2*#2);
y13 = y33 = yBor + Rand(1*#2);
y14 = y34 = yBor + Rand(1*#2);
x21 = x31 = xBor + Rand(6*#2);
x24 = x34 = xBor + Rand(6*#2);
x22 = x32 = \overlaywidth-xBor + Rand(6*#2);
x23 = x33 = \overlaywidth-xBor + Rand(6*#2);
y21 = y22 = \overlayheight+yCor;
y23 = y24 = 0;
fill (z31--z32--z33--z34--cycle) withcolor \MPcolor{\overlaycolor};
}

\startuseMPgraphic{F}
\Log{2.5pt}%
\ObdobiFrame{3pt}{1}%
\stopuseMPgraphic

\defineoverlay[F][\uniqueMPgraphic{F}]
\defineframed[F]
[offset=2mm,rulethickness=.5mm,align={middle,lohi},strut=yes,
backgroundcolor=gray,background=F,frame=off,
]

\starttext
\noindent\dorecurse{256}{\F{\recurselevel} }
\stoptext
----------------------------------------------------------------