[metapost] Problem with clip and svg output
Pétiard François
petiard.francois at free.fr
Fri Nov 4 15:30:52 CET 2022
Hello
With that file:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
prologues:=3;
outputtemplate:="%j_%c.%{outputformat}";
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%% EPS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
outputformat:="eps";
u:=1bp;
beginfig(1);
for i=-12 upto 2:
draw u*(2*i,-10)--u*(2*i+20,10);
endfor;
clip currentpicture to fullcircle scaled(20u);
draw fullcircle scaled(20u);
endfig;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%% SVG %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
outputformat:="svg";
u:=5bp;
beginfig(1);
for i=-12 upto 2:
draw u*(2*i,-10)--u*(2*i+20,10);
endfor;
clip currentpicture to fullcircle scaled(20u);
draw fullcircle scaled(20u);
endfig;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%% PNG %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
outputformat:="png";
u:=10bp;
outputformatoptions:="format=rgba antialias=best";
beginfig(1);
for i=-12 upto 2:
draw u*(2*i,-10)--u*(2*i+20,10);
endfor;
clip currentpicture to fullcircle scaled(20u);
draw fullcircle scaled(20u);
endfig;
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
the eps and the png output are correct but not the svg output (the clip
is rectangular, not round).
Is it normal (limitation of svg, for example) ?
Best regards
François Pétiard
More information about the metapost
mailing list.