xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Danilo Costa <daniloco...@gmail.com>
Subject Re: Centering the SVG - Differences among affineTransforms
Date Fri, 14 Jan 2005 11:51:34 GMT
Thanks Kai!! It will help me a lot!

Best regards

Danilo


On Fri, 14 Jan 2005 08:58:57 +0100, Meves Kai (ext)
<Kai.Meves.ext@ptd.siemens.de> wrote:
> Hello,
> 
> >  2 - How do the coords in AffineTransform, returned by
> > "svgCanvas.getViewBoxTransform()",   work?
> >  Neither the screens corrds nor the canvas corrds worked appropriately
> > when I tried to use translation operations.
> >
> > 3 - Are there some way to map canvas coords to screen coords
> > and vice-versa?
> 
> Yes, of course there is. What you get by calling getViewBoxTransform() is
> the current Transformation Matrix, Batik uses to do the Transformation from
> world coordinates to screen coordinates. You can do something like this:
> 
> AffineTransform affTrans = myCanvas.getViewBoxTransform();
> affTrans.transform(point1,point2) //where point1 and point2 are some Point2D
> 
> and you get the screen coordinates from the world coordinates that are
> stored in point1 as result in point2.
> 
> If you want to do it the other way round (screen coordinates to world
> coordinates), you need to use the inverse of the Transform Matrix, which you
> get by
> 
> affTransInv = affTrans.createInverse();
> 
> I hope that I remembered all of this correctly... :-)
> 
> Kind regards,
> Kai.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 


-- 
"...YOU CANNOT KNOW THE MEANING OF YOUR LIFE UNTIL YOU ARE CONNECTED
WITH THE POWER THAT CREATED YOU..."
Shri Mataji Nirmala Devi

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


Mime
View raw message