I use SVG Salamander to display and manipulate SVG images in Java. I managed to change fill, stroke or text of elements and display the changes.
Now I want to rotate an element. So I tried to manipulate the transformation matrix:
SVGElement e = diagram.getElement("path4150");
System.out.println(e.getPresAbsolute("transform").getStringValue());
StyleAttribute t = e.getPresAbsolute("transform");
double[] d = t.getDoubleList();
d[0] = -0.39394618;
d[1] = -0.91913346;
d[2] = 0.91913357;
d[3] = -0.39394618;
d[4] = -429.42706;
d[5] = 1513.019;
t.setStringValue("matrix(" + Joiner.on(",").join(Doubles.asList(d)) + ")");
System.out.println(e.getPresAbsolute("transform").getStringValue());
diagram.render(graphics);
Output:
matrix(0.87615346,0.48203226,-0.48203232,0.87615346,468.09264,-25.725313) matrix(-0.39394618,-0.91913346,0.91913357,-0.39394618,-429.42706,1513.019)
As I can see in the output, the matrix is changed. But the element is not rotating in the picture.