我按照如何使用 Apache Batik 将一个 SVG 图像叠加到另一个上的说明(以及来自其他来源的一些额外细节)进行操作?
直到现在,大部分时间事情都运行良好。但是,现在,我的每个 svg 文档(图像)都有剪辑路径。当我放置 2 个或更多图像时,只有第二个路径保存在输出中。我丢失了所有其他剪辑路径。我需要做些什么来保留每个图像的剪辑路径吗?我查看了 SVG 输出,只看到一个剪辑路径。我的代码如下所示:
public void PlaceSVGImage(SVGDocument a, Point C)
{
String xatt = String.format("%f", C.X);
String yatt = String.format("%f", C.Y);
org.w3c.dom.Node ae = SVGC.SVGD.importNode(a.getDocumentElement(), true);
((Element) ae).removeAttribute("viewBox");
((Element) ae).setAttribute("x", xatt);
((Element) ae).setAttribute("y", yatt);
if (FIRSTCHILD)
{
SVGC.SVGD.getDocumentElement().appendChild(ae);
FIRSTCHILD = false;
NullNode = ae;
}
else
{
SVGC.SVGD.getDocumentElement().insertBefore(ae, NullNode);
}
}
然后我使用一些标准代码来显示 SVGC.SVGD。
任何见解将不胜感激。