\setuppagenumber[state=stop]
\setupcolors[state=start]

\startuniqueMPgraphic{test}
    save p,q; picture p; path q;

    q:= unitsquare xyscaled (OverlayWidth,.5OverlayHeight);
    p:= image(linear_shade(q,6,red,green));

    addto currentpicture also p;
    addto currentpicture also (p yshifted .5OverlayHeight);
\stopuniqueMPgraphic

\defineoverlay[test] [\uniqueMPgraphic{test}]

\starttext
\framed[width=10cm,height=10cm,background=test]{}
\stoptext
