Paul Wellner Bou <[email protected]> wrote on 06/19/2009 02:22:02 AM:

> [...] with other (SVG)Elements, I am doing this in plain xml attributes:
> 
>      String transformMatrix= "matrix(" + mat.getA() + " " + mat.getB() + 

> " " + mat.getC() + " " + mat.getD() + " " + mat.getE() + " "
>          + mat.getF() + ")";
>      myElement.setAttribute("transform", transformMatrix);

> Johan Brelet <[email protected]> wrote on 06/05/2009 06:02:15 AM:

>> I'm trying to work with matrix. What I'd like is to get the 
>> transformation matrix of a shape compared to root of SVG, and remove
>> only "translate" transformations. Here is how I'm currently doing it :
>> 
>> SVGMatrix matrix = myshape.getTransformToElement(svg);

   Paul is pointing in the right direction.  The matrix returned
from getTransformToElement is not a changeable matrix. So modifying it
does not change the document in any way.

> //Only take into account "translate" transformations, e.g. matrix.e 
> (tx) and matrix.f (ty)
> matrix.setA(1);
> matrix.setB(0);
> matrix.setC(0);
> matrix.setD(1);
> 
> But the matrix doesn't seems to be updated (a b c and d are kept 
unchanged)...
> Am I doing something wrong?

        You need to copy the matrix into one you create from the SVG root 
element.  Then you need
to set the matrix on something (similar to what Paul suggests).

Reply via email to