ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* MP & text transparency
@ 2017-04-24 13:11 Procházka Lukáš Ing.
  2017-04-24 13:39 ` Thomas A. Schmitz
  0 siblings, 1 reply; 4+ messages in thread
From: Procházka Lukáš Ing. @ 2017-04-24 13:11 UTC (permalink / raw)
  To: ConTeXt

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

Hello,

suppose having the following code:

----
\startuseMPgraphic{T}
   newpath rc; rc := fullsquare xyscaled (50mm, 50mm);
   color col; col := (1.,.1,.1);
   draw rc withpen pencircle scaled (2.5mm) withcolor %col;
                                                      transparent(1, .4, col);

   draw thelabel(btex\setupbodyfont[sans,35mm] Test etex, (80mm, 50mm))
     withcolor %col
               transparent(1, .4, col)
     ;
\stopuseMPgraphic

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

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

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

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


-- 
Ing. Lukáš Procházka | mailto:LPr@pontex.cz
Pontex s. r. o.      | mailto:pontex@pontex.cz | http://www.pontex.cz | IDDS:nrpt3sn
Bezová 1658
147 14 Praha 4

Tel: +420 241 096 751 (+420 720 951 172)
Fax: +420 244 461 038

[-- Attachment #2: MP-Trans.mkiv --]
[-- Type: application/octet-stream, Size: 559 bytes --]

\startuseMPgraphic{T}
  newpath rc; rc := fullsquare xyscaled (50mm, 50mm);
  color col; col := (1.,.1,.1);
  draw rc withpen pencircle scaled (2.5mm) withcolor %col;
                                                     transparent(1, .4, col);

  draw thelabel(btex\setupbodyfont[sans,35mm] Test etex, (80mm, 50mm))
    withcolor %col
              transparent(1, .4, col)
    ;
\stopuseMPgraphic

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

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

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

[-- Attachment #3: MP-Trans.pdf --]
[-- Type: application/pdf, Size: 5009 bytes --]

[-- Attachment #4: 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] 4+ messages in thread

* Re: MP & text transparency
  2017-04-24 13:11 MP & text transparency Procházka Lukáš Ing.
@ 2017-04-24 13:39 ` Thomas A. Schmitz
  2017-04-24 14:40   ` Procházka Lukáš Ing.
  2017-04-24 17:36   ` Hans Hagen
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas A. Schmitz @ 2017-04-24 13:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

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

* Re: MP & text transparency
  2017-04-24 13:39 ` Thomas A. Schmitz
@ 2017-04-24 14:40   ` Procházka Lukáš Ing.
  2017-04-24 17:36   ` Hans Hagen
  1 sibling, 0 replies; 4+ messages in thread
From: Procházka Lukáš Ing. @ 2017-04-24 14:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello,

that works fine, thank you!

Best regards,

Lukas


On Mon, 24 Apr 2017 15:39:56 +0200, Thomas A. Schmitz <thomas.schmitz@uni-bonn.de> wrote:

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


-- 
Ing. Lukáš Procházka | mailto:LPr@pontex.cz
Pontex s. r. o.      | mailto:pontex@pontex.cz | http://www.pontex.cz | IDDS:nrpt3sn
Bezová 1658
147 14 Praha 4

Tel: +420 241 096 751 (+420 720 951 172)
Fax: +420 244 461 038

___________________________________________________________________________________
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] 4+ messages in thread

* Re: MP & text transparency
  2017-04-24 13:39 ` Thomas A. Schmitz
  2017-04-24 14:40   ` Procházka Lukáš Ing.
@ 2017-04-24 17:36   ` Hans Hagen
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2017-04-24 17:36 UTC (permalink / raw)
  To: ntg-context

On 4/24/2017 3:39 PM, Thomas A. Schmitz wrote:

>   drawoptions(withcolor \MPcolor{tred})

nowadays you can also say: withcolor "tred"


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2017-04-24 17:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-24 13:11 MP & text transparency Procházka Lukáš Ing.
2017-04-24 13:39 ` Thomas A. Schmitz
2017-04-24 14:40   ` Procházka Lukáš Ing.
2017-04-24 17:36   ` Hans Hagen

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).