I think you want the 
org.apache.batik.parser.AWTTransformProducer.createAffineTransform(...) method. 
 Getting it back to the transform="matrix(...)" is messier.  I used 
AffineTransform.getMatrix() and MessageFormat to put it back into the element.

Michael Bishop



From: Lars Eirik Rønning
Sent: Tue 6/3/2008 7:21 AM
To: [email protected]
Subject: Re: Transform attribute


thanks.
I was more interesting in finding a way to retrive the transform attribute and 
modify this without having to parse the string myself..
transform="matrix(1 0 0 1 349 384)".. i do not really consider it the best idea 
to do this parsing myself if there exisits a method which allows me to do for 
instance do somthing similar to

pseudocode:
Transformation t = Transformation.getMatrixObject(String matrixString);
double x = t.getTranslateX();
t.setTraslateX(x+40);
element.setAttribute(SVGConstants.SVG_Transform_Attribute,t.getString());




On Tue, Jun 3, 2008 at 12:49 PM, Guillaume Rosauro <[EMAIL PROTECTED]> wrote:


Hi,

You can retrieve all elements from the SVG file like any other XML file. So 
getElementById or something like that should be sufficient.


Guillaume 

 



On Tue, Jun 3, 2008 at 12:37 PM, Lars Eirik Rønning <[EMAIL PROTECTED]> wrote:

Hi.
Is there an easy way for me to retrieve the affine transformation such as an 
element's matrix from an exisiting svg file and alter only the translation 
aspect of the matrix?
I was hoping i could get this as a string attribute and then have a object 
which allowed me to extract the values i wanted without having to parse the 
string..
When the values are altered i would like to insert this back as a string into 
the svg file.

Thanks
Lars

Reply via email to