据说DOMException - with error code NOT_SUPPORTED_ERR if the requested trait is not supported on this element or null.
我正在尝试水平翻转我的SVG图像,但我遇到了这个错误。
InputStream svgStream = getClass().getResourceAsStream(path);
SVGImage svgImage = (SVGImage) (SVGImage.createImage(svgStream, null));
SVGSVGElement myEl = (SVGSVGElement) svgImage.getDocument().getDocumentElement());
SVGMatrix transformMatrix = myEl.getScreenCTM();
transformMatrix = transformMatrix.mTranslate(100f, 0f);
myEl.setMatrixTrait("transform", transformMatrix);
答案 0 :(得分:1)
<svg>
个元素在SVG 1.1中无法转换(无转换属性)。
“仍在编写”的SVG 2规范应该改变它,以便在规范完成并且UA实现它之后,它们将在未来的某个时刻出现。
如果要设置转换,请将要转换的内容放在可转换容器中,例如一个<g>
元素并对其进行转换。