[NTG-context] shading in metapost

Aditya Mahajan adityam at umich.edu
Thu Jan 24 09:03:27 CET 2008


Hi Thomas,

On Thu, 24 Jan 2008, Thomas A. Schmitz wrote:

> On Jan 24, 2008, at 1:28 AM, Mojca Miklavec wrote:
>>
>> In theory possible, but in practice not implemented in metafun. But
>> see
>>    http://www.fauskes.net/media/pgf/pgfmanualCVS2008-01-23.pdf
>> It might satisfy your needs. (Impressive!)
>>
>> Mojca
>
> Thanks, Mojca, that's what I suspected. For the time being, I prefer
> metafun just because I know a little bit about it (and almost nothing
> about tikz).

TikZ has a nice interface. The only drawback right now is the speed. 
Hopefully sometime in the near future, some of the backend of tikz will be 
written in lua and mplib, which will make things much faster.

> I have solved the problem at hand by drawing ten
> instances of a very transparent black circle on top of each other and
> increasing the scale of the pencircle slightly at every run. Which
> leads me to one last question: I wanted to be clever and do it in a
> for-loop like this:
>
>  for i=1 upto 10:
>  	pickup pencircle scaled (i*0.5) pt ;
>  	draw fullcircle scaled 5mm withcolor transparent (1,0.04,black) ;
>  endfor ;
>
> Is this because the expression "pencircle scaled" expects a "numeric
> primary" as argument? And is there any way around this?

scaled expects a dimension. (i*0.5)pt is not a dimension. You need to 
either write (i*0.5pt) or ((i*0.5)*1pt). The extra parenthesis are needed 
to keep the metapost parser happy.

Aditya


More information about the ntg-context mailing list