Hi Mistercaste,
mistercaste <[email protected]> wrote on 12/02/2009 07:19:35 AM:
> I need to fit my canvas around an Element of my SVG document.
> On the forum I found advice that said to do get the Screen CTM
> of the Element and that's what I did.
> But actually I don't know how to use this CTM in combination with
> the RenderingTransform.
Once again I must stress that you need to learn about Affine
Transforms.
You can find similar code in Batik's SVG browser's 'find' dialog
(batik.apps.svgbrowser.FindDialog.showSelectedGraphicsNode)
> Here follows my code:
>
>
> void centerOnElement(Element elementToCenter) {
> SVGMatrix matrix = ((SVGLocatable)
elementToCenter).getScreenCTM();
>
> float[] flatMatrix = {
> matrix.getA(),
> matrix.getB(),
> matrix.getC(),
> matrix.getD(),
> matrix.getE(),
> matrix.getF()};
>
> final AffineTransform elementAT = new
AffineTransform(flatMatrix);
>
> UpdateManager um = canvas.getUpdateManager();
> um.getUpdateRunnableQueue().invokeLater(new Runnable() {
>
> @Override
> public void run() {
> at = canvas.getInitialTransform();
> /*
> * How do I work the elementAT AffineTransform
> * so that it fits the element in the canvas?
> */
> canvas.setRenderingTransform(at);
> }
> });
> }
>
>
>
>
> Thank you.
>
>
>
> --
> View this message in context: http://old.nabble.com/Fit-JSVGCanvas-
> around-an-Element-tp26607989p26607989.html
> Sent from the Batik - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>