[NTG-context] Shading transparency / missing linear_shade variant

Eckhart Guthöhrlein eckhart.guthoehrlein at uni-bielefeld.de
Fri Jul 23 14:07:13 CEST 2004


Hi all,

experimenting with transparencies, I have obviously come to a
limitation: color shading does not work for transparent colors. What I
have in mind is a bar filled with a color gradient, starting from a
certain (non-transparent) color and ending transparent, i.e. vanishing
into the background. However, the transparent color appears just black.

Furthermore, the shading variants for linear_shade do not correspond
with those listed in the metafun manual, page 180. Variant 2 is missing
and behaves like variant 3 should.

Example:

\setupcolors[state=start]
\setupbackgrounds[page][background=color,backgroundcolor=red]

\startMPenvironment[global]
	\definecolor[HeadLineColor][r=0,g=0,b=1]
  \definecolor[Transparent][r=1,g=1,b=1,t=0,a=normal]
\stopMPenvironment

\startreusableMPgraphic{test}
	numeric u; u=3cm;
	path p;
	p := unitsquare xscaled u yscaled u cornered (u/10);
	for i=0 upto 3 :
		linear_shade(p shifted(i*u,0),i,\MPcolor{HeadLineColor},\MPcolor{Transparent});
	endfor;	
\stopreusableMPgraphic

\starttext
	\reuseMPgraphic{test}
\stoptext

-- 
Eckhart


More information about the ntg-context mailing list