ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Thomas A. Schmitz" <thomas.schmitz@uni-bonn.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: MP & text transparency
Date: Mon, 24 Apr 2017 15:39:56 +0200	[thread overview]
Message-ID: <c9238698-4a6a-fa94-1e16-76f97c8eef7d@uni-bonn.de> (raw)
In-Reply-To: <op.yy7aw1lx62epfj@lprx>

On 24.04.2017 15:11, Procházka Lukáš Ing. wrote:
> The rectangle drawn is transparent, which is OK.
>
> But the text "Test" is not, is it fully red; why?
>
> How to specify text to be partially transparent, too?
>
> TIA.
>
> Best regards,
>
> Lukas

Wouldn't it be better to define the transparency in ConTeXt and use it 
for both text and drawing? Like this:

\definecolor [tred] [r=1,g=0,b=0,t=.2,a=1]

\startuseMPgraphic{T}
   newpath rc; rc := fullsquare xyscaled (50mm, 50mm);
   color col; col := (1.,.1,.1);
   drawoptions(withcolor \MPcolor{tred}) ;
   draw rc withpen pencircle scaled (2.5mm) ;
   label(textext("\setupbodyfont[sans,35mm] \color[tred]{Test}"), (80mm, 
50mm)) ;
\stopuseMPgraphic

\defineoverlay[T][\useMPgraphic{T}]

\setupbackgrounds[page][background={foreground,T}]

\startTEXpage[width=200mm,height=200mm]
\stopTEXpage

See ch. 8.2 of the metafun manual.

HTH

Thomas
___________________________________________________________________________________
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:[~2017-04-24 13:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-24 13:11 Procházka Lukáš Ing.
2017-04-24 13:39 ` Thomas A. Schmitz [this message]
2017-04-24 14:40   ` Procházka Lukáš Ing.
2017-04-24 17:36   ` Hans Hagen

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=c9238698-4a6a-fa94-1e16-76f97c8eef7d@uni-bonn.de \
    --to=thomas.schmitz@uni-bonn.de \
    --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).