ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* drop shadows with metapost/ metafun
@ 2020-12-29 21:56 Garulfo
  2021-01-01  7:09 ` Aditya Mahajan
  2021-01-02 10:38 ` Henning Hraban Ramm
  0 siblings, 2 replies; 4+ messages in thread
From: Garulfo @ 2020-12-29 21:56 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 954 bytes --]

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.

Thanks again for your help.

[-- Attachment #1.2: Type: text/html, Size: 1749 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 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: drop shadows with metapost/ metafun
  2020-12-29 21:56 drop shadows with metapost/ metafun Garulfo
@ 2021-01-01  7:09 ` Aditya Mahajan
  2021-01-01  7:15   ` Aditya Mahajan
  2021-01-02 10:38 ` Henning Hraban Ramm
  1 sibling, 1 reply; 4+ messages in thread
From: Aditya Mahajan @ 2021-01-01  7:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

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

[-- Attachment #2: Type: text/plain, Size: 493 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: drop shadows with metapost/ metafun
  2021-01-01  7:09 ` Aditya Mahajan
@ 2021-01-01  7:15   ` Aditya Mahajan
  0 siblings, 0 replies; 4+ messages in thread
From: Aditya Mahajan @ 2021-01-01  7:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

On Fri, 1 Jan 2021, Aditya Mahajan wrote:

> On Tue, 29 Dec 2020, Garulfo wrote:
> 
> > Which process would you advice to add « drop shadows » to any kind of metafun / metapost figures like:
>
> > 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. 

Also, if you don't want the shadows to be too nice, you can also translate the fake shadows used by tikz to metapost:

https://adityam.github.io/context-blog/post/drop-shadow-with-lifted-corners/

Aditya

[-- Attachment #2: Type: text/plain, Size: 493 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: drop shadows with metapost/ metafun
  2020-12-29 21:56 drop shadows with metapost/ metafun Garulfo
  2021-01-01  7:09 ` Aditya Mahajan
@ 2021-01-02 10:38 ` Henning Hraban Ramm
  1 sibling, 0 replies; 4+ messages in thread
From: Henning Hraban Ramm @ 2021-01-02 10:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users



> Am 29.12.2020 um 22:56 schrieb Garulfo <garulfo@azules.eu>:
> 
> 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.

I don’t know if that helps, but I’m using a stack of transparent objects to simulate drop shadows:
https://wiki.contextgarden.net/Drop_shadows

No pixel images required. But I’d like to have a real text shadow instead of that box shadow.


Happy New Year!
Hraban
___________________________________________________________________________________
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:[~2021-01-02 10:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-29 21:56 drop shadows with metapost/ metafun Garulfo
2021-01-01  7:09 ` Aditya Mahajan
2021-01-01  7:15   ` Aditya Mahajan
2021-01-02 10:38 ` Henning Hraban Ramm

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