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
___________________________________________________________________________________

Reply via email to