On Wed, 27 Jun 2007 10:53:47 +0300, Keywan Najafi Tonekaboni <[EMAIL PROTECTED]> wrote:

Am Mittwoch, den 27.06.2007, 10:19 +0300 schrieb Antti Karanta:

If not, how do I produce a new (rotated) svg from an existing svg? All I found on this was how to do it w/ JSVGCanvas, but I need to do this w/out
starting a gui.

an SVGGraphics2D has the method rotate. Maybe this is helpful and it is not a GUI, or?

http://xmlgraphics.apache.org/batik/using/svg-generator.html

Thanks, this could be what I'm looking for. There is still something I am missing, though, as I can't get it working. This is what I did (a little simplified):

    String svg = ... // generated internally inside the app
String parser = XMLResourceDescriptor.getXMLParserClassName() ;
    SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory( parser ) ;

    Reader svgreader = new StringReader( svg ) ;

Document doc = factory.createDocument( SVGDOMImplementation.SVG_NAMESPACE_URI, svgreader ) ;

    boolean rotateClockwise = ...

    double theta = ( rotateClockwise ? -Math.PI : Math.PI ) / 2 ;
    SVGGraphics2D graphics = new SVGGraphics2D( doc ) ;
    graphics.rotate( theta ) ;
    graphics.dispose() ;


But nothing happened, i.e. when I transcoded doc into png, the pic was not rotated. What might I be missing? Could it be that SVGGraphics2D is meant for creating svg content starting from a clean slate, but it is not able to manipulate existing svg? I.e. does it assume that the Document I pass in the constructor is empty?



      -Antti-




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to