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
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
Hello,
that works fine, thank you!
Best regards,
Lukas
On Mon, 24 Apr 2017 15:39:56 +0200, Thomas A. Schmitz
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
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 -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
Procházka Lukáš Ing.
-
Thomas A. Schmitz