![](https://secure.gravatar.com/avatar/c5ae4f9aa0d3a9bd5376e92b322c3e50.jpg?s=120&d=mm&r=g)
On Thu, 8 Nov 2012, Hans Hagen wrote:
(just to illustrate that an overlay can be used for anything)
This prompted me to finish testing what I had been thinking about for a while. In most cases, metapost is sufficient for drawing backgrounds, but occasionally using tikz is nicer. For example, when tikz provides a solution that is not available in metapost (e.g., drawing "snake" paths), or extremely difficult to get right in metapost (drawing shadows). As Hans said, overlays can be used for anything, including tikz background. Here is a proof of concept implementation: \usemodule[tikz] \usetikzlibrary[decorations.pathmorphing] \def\TIKZdecorationoverlay {\starttikzpicture \expanded{\draw[\overlaylinecolor, line width=\overlaylinewidth, decorate, decoration={\framedparameter{decoration}}] (0,0)--(\overlaywidth,0) -- (\overlaywidth,\overlayheight) -- (0,\overlayheight) -- cycle;} \stoptikzpicture} \defineoverlay[decoration][\TIKZdecorationoverlay] \setupframed [decoration=snake] \starttext \framed[frame=off, rulethickness=3bp, background=decoration, backgroundoffset=3mm, framecolor=red, align=normal] {\input ward \endgraf} \blank[2*big] \externalfigure [cow] [frame=off, frameoffset=5pt, backgroundoffset=frame, background=decoration, decoration={coil, amplitude=4pt, segment length=5pt}] \stoptext Aditya