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 floyd82 <ma...@iluZio.de> on 2009/05/22 15:55:54 UTC

Apply a SVG transform to a point

Hello,

with the following code I retrieved a SVG rect from a document:

      Element e = doc.getElementById("my_group_id");
      SVGOMRectElement rect = (SVGOMRectElement) e;

This element owns a transform matrix. Now I want to find out, where the 4
points of this rect are exactly located. For example the attributes say,
that left upper point is at (x 200, y 300), but with transform matrix the
point is at a completely different location.

My idea was this, to apply the transform matrix on the 4 points. Is this the
right way? And if so, how can it be done?

Thank you very much!
floyd
-- 
View this message in context: http://www.nabble.com/Apply-a-SVG-transform-to-a-point-tp23670930p23670930.html
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: Apply a SVG transform to a point

Posted by Helder Magalhães <he...@gmail.com>.
Hi floyd,


> This element owns a transform matrix. Now I want to find out, where the 4
> points of this rect are exactly located.

I guess this is a general SVG question (not Batik-specific). When
asking about this sort of stuff, you may find the SVG Developers
mailing list [1] a bit more responsive. ;-)

I'm not sure if Batik provides some sort of convenience in order to
determine this but, thinking general, you can do the maths and
determine the coordinates yourself: please consider getting a bit of
background on the SVG coordinate system regarding transform matrices
[2]. ;-)


> My idea was this, to apply the transform matrix on the 4 points. Is this the
> right way? And if so, how can it be done?

Yes, I'd say so. Whenever you want to transform a whole object, or set
of objects (using the <g> element to group them), a transform is the
most appropriate mechanism. The transform matrix can sometimes be a
little harder to read, but you may also specify transforms using the
textual version ("translate", "scale", "rotate", etc.). Please take a
look at the transform attribute [3] definition.


Hope this helps,
 Helder


[1] http://tech.groups.yahoo.com/group/svg-developers/
[2] http://www.w3.org/TR/SVG11/coords.html#TransformMatrixDefined
[3] http://www.w3.org/TR/SVG11/coords.html#TransformAttribute

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