Wednesday, April 9, 2003 Patrick Gundlach wrote:
PG> Giuseppe Bilotta
\startuseMPgraphic{mpos:par:columnset} path p, q; for i := 1 upto nofmultipars : p := counterclockwise simplified multipars[i] leftenlarged 5pt rightenlarged 5pt ;
PG> why did you use "counterclockwise simplified..." ? What is this? I used that to make sure that p didn't have extra points (simplified) and went in a specific direction (counterclockwise); anyway, I rewrote my code: === \starttext \setupcolors[state=start] \definetextbackground[gb][state=start] \startuseMPgraphic{mpos:par:columnset} pair urc, ulc, llc, lrc ; % corners path urcp, ulcp, llcp, lrcp ; % paths path q ; cornerradius := 5pt ; offset := 7.5pt ; color framecolor, backgroundcolor ; pen framepen ; framecolor := red ; framepen := pensquare rotated 45 ; framethickness := 2pt ; backgroundcolor := lightgray ; for i := 1 upto nofmultipars : urc := urcorner multipars[i] + (offset, offset) ; ulc := ulcorner multipars[i] + (-offset, offset) ; llc := llcorner multipars[i] + (-offset, -offset) ; lrc := lrcorner multipars[i] + (offset, -offset) ; ulcp := quartercircle rotated 90 scaled (2*cornerradius) shifted (ulc + (cornerradius, -cornerradius)) ; urcp := quartercircle scaled (2*cornerradius) shifted (urc + (-cornerradius, -cornerradius)) ; llcp := quartercircle rotated 180 scaled (2*cornerradius) shifted (llc + (cornerradius, cornerradius)) ; lrcp := quartercircle rotated -90 scaled (2*cornerradius) shifted (lrc + (-cornerradius, cornerradius)) ; if multilocs[i] = 1 : % top q := lrc -- urcp -- ulcp -- llc ; fill q--cycle withcolor backgroundcolor ; draw q withcolor framecolor withpen framepen scaled framethickness ; elseif multilocs[i] = 2 : fill llc -- lrc -- urc -- ulc -- cycle withcolor backgroundcolor ; draw ulc -- llc withcolor framecolor withpen framepen scaled framethickness ; draw lrc -- urc withcolor framecolor withpen framepen scaled framethickness ; else: q := ulc -- llcp -- lrcp -- urc ; fill q--cycle withcolor backgroundcolor ; draw q withcolor framecolor withpen framepen scaled framethickness ; fi endfor ; \stopuseMPgraphic \starttextbackground[gb] \input tufte \stoptextbackground \blank[2*big] \starttextbackground[gb] \dorecurse{5}{\input tufte \par} \stoptextbackground \blank \input tufte \stoptext === Now the only thing we need is a way to know when the background is split and when it's not. Hans? -- Giuseppe "Oblomov" Bilotta