[NTG-context] drop shadows with metapost/ metafun

Aditya Mahajan adityam at umich.edu
Fri Jan 1 08:09:59 CET 2021


On Tue, 29 Dec 2020, Garulfo wrote:

> Which process would you advice to add « drop shadows » to any kind of metafun / metapost figures like:
> picture p;
> p := textext("MetaPost is fun!") shifted (10cm,10cm);
> 
> My current understanding of the required steps :
> 
> 
> 1- fill p with the shadow color
> 
> 2- write it to an external metapost file (with savebuffer ?) ready for png export (outputformat := "png »;)
> 
> 3- with lua, os.execute, and imagemagick prepare the shadow
>   - extent the png file with a transparent background, to have room for blurring 
>   - blur it
> 
> 4- import this png in context / Metapost (externalfigure), and center it with p figure
> 
> 5- shift it according to the desired shadows distance and angle
> 
> 6- apply the initial bounding box of p to the shadow, draw the shadow, draw the p picture 
> 
> 
> Actually, all this seems long and tedious, and contrasts with the already existing links between MetaPost / MetaFun and cairo + libpng.

There was a drops module by Peter Rolf, which provides exactly these features:

https://mailman.ntg.nl/pipermail/ntg-context/2016/084242.html

It is not part of modules.contextgarden.net and the url in the previous post is no longer valid. 

I am CC:ing Peter and perhaps he can point to the updated location for the module. 

Aditya


More information about the ntg-context mailing list