ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Garulfo <garulfo@azules.eu>
To: ntg-context@ntg.nl
Subject: drop shadows with metapost/ metafun
Date: Tue, 29 Dec 2020 22:56:40 +0100	[thread overview]
Message-ID: <CFAD7E2B-C80E-4412-8412-20BCD98282A9@azules.eu> (raw)


[-- 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
___________________________________________________________________________________

             reply	other threads:[~2020-12-29 21:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-29 21:56 Garulfo [this message]
2021-01-01  7:09 ` Aditya Mahajan
2021-01-01  7:15   ` Aditya Mahajan
2021-01-02 10:38 ` Henning Hraban Ramm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CFAD7E2B-C80E-4412-8412-20BCD98282A9@azules.eu \
    --to=garulfo@azules.eu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).