Hi everybody,
In my application I am translating, scaling and rotating elements
using a transform attribute on each element in the following way:
transform="translate(x,y) scale(s) rotate(r, cx, cy)"
In order to edit the transforms of each element in my document I am
accessing the element's SVGTransformList and then editing the
properties of the SVGTransforms in the list. This works great except
for rotation transforms. When I use SVGTransform.setRotate(rotation,
cx, cy) the canvas is updated as it should be and the element is
rotated by the correct amount around cx,cy. If, however, I then call
System.out.println(e.getAttribute("transform")) I can see the rotation
amount but the optional cx and cy components of the rotate transform
are missing from the DOM. This means that when save my document to a
file the resulting svg document has all of the rotate transforms
acting around the origin and, as a result, is a complete mess.
The code I am using to rotate an element looks like this:
SVGTransformable s = (SVGTransformable) e;
SVGAnimatedTransformList atl = s.getTransform();
SVGTransformList tl = atl.getBaseVal();
AbstractSVGTransform trans = (AbstractSVGTransform)
tl.getItem(2);
if (trans.getType() == trans.SVG_TRANSFORM_ROTATE) {
trans.setRotate(initialAngle + differenceAngle,
center.getX(), center.getY());
I can not understand why the element would be displayed correctly
inside Batik even though the DOM is not being correctly updated. Is it
possible that the GVT tree is being updated and the DOM is not?
I have thoroughly checked the rest of my program and am pretty certain
the problem is with my use of this method. Can anyone see an error I
am making here, or is this a Batik bug?
Any help would be greatly appreciated.
Oliver
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]