Yes, except for at.getScaleX(), I do: double[] matrixValues = new double[6]; matrix.getMatrix(matrixValues);
Then I use matrixValues[0 - 5] to populate the "matrix" part of the "transform" attribute. Although, reading the Javadoc, I guess it doesn't matter. You could use: getScaleX(), getShearY(), getShearX(), getScaleY(), getTranslateX(), and getTranslateY() in that order to get the same values. Either way, it's a little tedious, but it works. Michael -----Original Message----- From: HODAC, Olivier [mailto:[email protected]] Sent: Wednesday, September 02, 2009 10:56 AM To: [email protected] Subject: RE: transform attribute marshaller Thanks michael If I understand well, I create a new affineTransform from the attribute transform string using the static method AffineTransform at = AWTTransformProducer.createAffineTransform(String s) Then, I use the setters from the AffineTransform to set the rotation value, etc... Finally, I use the standart java MessageFormat stuff to marshall it? You mean that I explicitely write: MessageFormat.format("matrix(%f %f %f %f %f %f)", at.getScaleX() , etc...)? -----Message d'origine----- De : Bishop, Michael W. CTR USJFCOM JFL [mailto:[email protected]] Envoyé : mercredi 2 septembre 2009 16:35 À : [email protected] Objet : RE: transform attribute marshaller Hello, I use Batik's AWTTransformProducer to go from a "transform" attribute to an AffineTransform. I manipulate the AffineTransform however I need to, then use the MessageFormat class to write out the "transform" attribute with the 6 values of the matrix. I haven't found a better way to produce the "transform" attribute, but I find manipulating an AffineTransform to be easier to work with. I don't know how familiar you are with transforms, but you might want to search this list for "AffineTransformUtil" if transform operations don't work the way you "expect" them to with cumulative updates. Michael Bishop -----Original Message----- From: HODAC, Olivier [mailto:[email protected]] Sent: Wednesday, September 02, 2009 10:04 AM To: [email protected] Subject: transform attribute marshaller Hello, I am totally newby with batik and I am wondering if I am thinking right. I have seen that there is some parsers that are used with handlers. Butr here is my requirement: I want to change dynamically in java the position and some attributes of my initial svg file. I am focussing for the moment on the transform attribute (to move and rescale my object) and the fill attr ( to change the color) I am doing the following. You can see that I have to create the whole transform value string each time (I could have used the format method, by the way) by hand Is there a way to do that with some ready to use classes (ex: TransformableElement.setTransform(X_POS, value)) ? protected void setSize(double d) { getElt().setAttributeNS(null, "transform", "matrix("+d+" 0 0 "+d+" 243.3438 143.687)"); } getSvgCanvas().getUpdateManager().getUpdateRunnableQueue().invokeLater(n ew Runnable() { public void run() { setSize(theNewSize)); } }); } Olivier Dao Ho Dac Flight Test Software Architect Airbus France - EVIDA Phone : + 33 (0)5 67 19 81 34 Fax : +33(0)5 61 93 80 02 Mailto:[email protected] The information in this e-mail is confidential. The contents may not be disclosed or used by anyone other than the addressee. Access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, please notify Airbus immediately and delete this e-mail. Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent over public networks. If you have any concerns over the content of this message or its Accuracy or Integrity, please contact Airbus immediately. All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you should take whatever measures you deem to be appropriate to ensure that this message and any attachments are virus free. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] This mail has originated outside your organization, either from an external partner or the Global Internet. Keep this in mind if you answer this message. The information in this e-mail is confidential. The contents may not be disclosed or used by anyone other than the addressee. Access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, please notify Airbus immediately and delete this e-mail. Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent over public networks. If you have any concerns over the content of this message or its Accuracy or Integrity, please contact Airbus immediately. All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you should take whatever measures you deem to be appropriate to ensure that this message and any attachments are virus free. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
