ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Marco Patzer <lists@homerow.info>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Shading and transparency
Date: Wed, 11 Jul 2018 20:45:28 +0200	[thread overview]
Message-ID: <20180711204528.30c66187@homerow> (raw)

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

             reply	other threads:[~2018-07-11 18:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-11 18:45 Marco Patzer [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180711204528.30c66187@homerow \
    --to=lists@homerow.info \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).