From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: ntg-context@ntg.nl
Subject: [NTG-context] Re: Clip an image with a svg
Date: Fri, 3 Jan 2025 17:57:46 +0100 [thread overview]
Message-ID: <6d2c641d-30b6-4ac6-b61b-bc0d40a68414@gmail.com> (raw)
In-Reply-To: <5c74c374-9ea4-42e6-b0f6-60f7bba80c38@mailbox.org>
Am 03.01.2025 um 16:53 schrieb juh+ntg-context--- via ntg-context:
> Dear all,
>
> I found this example in the garden.
>
> \startMPclip{circleclip}
> clip currentpicture to fullcircle shifted (.5,.5)
> xscaled \width yscaled \height ;
> \stopMPclip
>
> \clip[nx=1,ny=1,mp=circleclip]{\externalfigure[hacker.png]}
>
> Aside from the fact that I failed to understand the shifted argument by
> playing around with values, I wonder if it is possible to use a SVG as
> clip for an image.
In the following example the yellow square is your picture, when you use
fullcircle without the shift you clipped image shows only the bottom
left corner (the part where the red circle and yellow square overlap).
To get the center of the picture you can either ship fullcircle by .5 in
the x and y direction or use unitcircle.
%%%% begin example
\startMPpage[offset=1cm]
fill unitsquare scaled 5cm withcolor "yellow" ;
draw hlingrid(0, 10, 1, 10cm, 10cm) shifted(-5cm,-5cm) ;
draw vlingrid(0, 10, 1, 10cm, 10cm) shifted(-5cm,-5cm) ;
draw origin withpen pencircle scaled 10 ;
draw fullcircle scaled 5cm withcolor "red" withpen pencircle scaled 5;
draw unitcircle scaled 5cm withcolor "green" withpen pencircle scaled 5;
\stopMPpage
%%%% end example
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
prev parent reply other threads:[~2025-01-03 16:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-03 15:53 [NTG-context] " juh+ntg-context--- via ntg-context
2025-01-03 16:57 ` Wolfgang Schuster [this message]
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=6d2c641d-30b6-4ac6-b61b-bc0d40a68414@gmail.com \
--to=wolfgang.schuster.lists@gmail.com \
--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).