You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by "Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil> on 2005/10/26 20:47:33 UTC

Conversion for AffineTransform?

I'm looking for something similar to SVGColor.toSVG() or
SVGShape.toSVG().  I see there's an SVGOMMatrix that takes an
AffineTransform as a constructor argument, but I don't see a way to
create the 'transform="..."' from it.  Does one exist?  Similarly, is
there one to go from a 'transform="..."' back to some object?  I'm doing
it with string parsing and it's kinda ugly.

 

Michael Bishop


Re: Conversion for AffineTransform?

Posted by th...@kodak.com.
Hi Michael,

"Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil> wrote on 
10/26/2005 02:47:33 PM:

> I?m looking for something similar to SVGColor.toSVG() or 
SVGShape.toSVG().  I 
> see there?s an SVGOMMatrix that takes an AffineTransform as a 
constructor 
> argument, but I don?t see a way to create the ?transform=???? from it.

    It's trivial to construct if you are willing to use the 'matrix()'
form.  You can also have a 'translate(tx, ty) matrix(sx, shy, shx, sy, 0, 
0)'
so the transform is pulled out (sx = scaleX, shx = shearX, etc).
If you don't want to use matrix then it depends on you knowing the
form of your affine.
 
> Does one exist?  Similarly, is there one to go from a ?transform=???? 
back to some 
> object?  I?m doing it with string parsing and it?s kinda ugly.

    You can use the parser classes from Batik:
        batik.parser.TransformListParser
      batik.parser.AWTTransformProducer


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org