Hi!

It's shadings and transparency again.

For most things transparency is not required since the background
colour (white) can be used instead, to achieve the same effect
(thanks Hans for the reimplementation/cleanup a while ago). For one
use case I worked around this by including an external file and
overlay the external file (see attached example).

Background: In the actual documents the transparent overlays overlay
images to have the edges fade into the page background (only the
centre is of interest).

Is there a method that does not require an external file or
pre-processing? Using the external file works. Just wondering if
there's a better - more integrated - way.

Marco
\definecolor [transparent] [a=multiply, t=1, s=1]

\startuseMPgraphic{trans}
  fill OverlayBox
    withshademethod "linear" withshadevector (3, 0)
    %% (white, "transparent") doesn't work here
    withshadecolors (white, white) withtransparency (0, .7);
\stopuseMPgraphic

%% to illustrate the effect, actual background is white
\setupbackgrounds [page] [background=color, backgroundcolor=lightgray]

\defineoverlay [gradient-mp]  [\useMPgraphic{trans}]
%% requires external file gradient-t.pdf
\defineoverlay [gradient-img] [{\externalfigure[gradient-t][width=\overlaywidth,height=\overlayheight]}]

\starttext
  using external image:
  \startframedtext [background={foreground, gradient-img}]
    \input knuth
  \stopframedtext
  metapost:
  \startframedtext [background={foreground, gradient-mp}]
    \input knuth
  \stopframedtext
\stoptext

Attachment: 5Z7.pdf
Description: Adobe PDF document

Attachment: gradient-t.pdf
Description: Adobe PDF document

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to