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 Keiti <ke...@web.de> on 2011/07/07 11:29:41 UTC

JSVGCanvas alignment

Hello!
I want to load a svg file into the SVGCanvas. This works fine, but the image is
centered. I´d like it to be on the top left corner.
Any ideas how to do that?

Thanks in advance.


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


Re: JSVGCanvas alignment

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

Keiti <ke...@web.de> wrote on 07/07/2011 05:29:41 AM:

> I want to load a svg file into the SVGCanvas. This works fine, but 
> the image is centered. I´d like it to be on the top left corner.
> Any ideas how to do that?

        You could override batik.swing.svg.JSVGComponent.
calculateViewingTransform
so it returns a transform that places the document in the top left corner
rather than centered. 

        Alternately you could set your preserveAspectRatio attribute on 
the 
SVG Content the right way since that attribute specifies how the document 
should be placed in this case.  The current calculateViewingTransform 
simply 
implements that part of the SVG specification.
Thomas DeWeese | CDG Advanced Development | 
Eastman Kodak Company | 343 State Street | Rochester, NY 14650-0128 | 
Thomas.DeWeese@Kodak.com | 585 724-0294 | 
www.kodak.com