ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Shading and transparency
@ 2018-07-11 18:45 Marco Patzer
  2018-07-11 21:11 ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Patzer @ 2018-07-11 18:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 689 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 5Z7.mkvi --]
[-- Type: text/x-tex, Size: 873 bytes --]

\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 #3: 5Z7.pdf --]
[-- Type: application/pdf, Size: 11484 bytes --]

[-- Attachment #4: gradient-t.pdf --]
[-- Type: application/pdf, Size: 2425 bytes --]

[-- Attachment #5: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-07-12 21:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11 18:45 Shading and transparency Marco Patzer
2018-07-11 21:11 ` Hans Hagen
2018-07-11 21:40   ` Marco Patzer
2018-07-12  9:21     ` Hans Hagen
2018-07-12 20:08       ` Marco Patzer
2018-07-12 20:59         ` Hans Hagen
2018-07-12 21:53           ` Marco Patzer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).