Java ME:如何水平/垂直翻转svg图像?

时间:2013-03-07 05:57:39

标签: java java-me matrix svg

谷歌最有帮助的结果是this,但在JavaME中的类SVGMatrix中没有scale()有两个参数可能与此类似:

TinyMatrix transform = (TinyMatrix) node.getAttribute(SVG.ATT_TRANSFORM);
transform.scale(-(1<<Tiny2D.DFIX_BITS), 1<<Tiny2D.DFIX_BITS );

可能可以通过定义我自己的翻转矩阵然后使用mMultiply()方法来做某事,但我也找不到网上的例子。

1 个答案:

答案 0 :(得分:0)

好的,我自己解决了,可以使用嵌入式SVG属性进行翻转:

SVGImage svgImage = (SVGImage) this.frames.elementAt(i);
Document doc = svgImage.getDocument();
SVGSVGElement svg = (SVGSVGElement) doc.getDocumentElement();
SVGElement image = (SVGElement) doc.getElementById("image");
SVGElement group = (SVGElement) doc.createElementNS(SVG_NAMESPACE_URI, "g");
group.appendChild(image);
group.setTrait("transform", "translate(200,200) scale(-1,1)");
svg.appendChild(group);
相关问题