xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bibek Sahu <scor...@dodds.net>
Subject graphics transforms
Date Wed, 07 Jan 2004 18:43:27 GMT

Howdy all,

I'm a bit stuck on some SVG graphics transforms (using Batik, but this is
probably more general than Batik); is this the appropriate forum for it, or
should I be checking elsewhere?  [if elsewhere, would you be so kind as to
provide some suggestions? :-)]

At any rate, I'm creating an SVG editor.  Now, suppose a user draws a
rectangle onto the SVG Canvas.  I add it basically just as they draw it:

	|        |	<rect x="10" y="20" width="5" height="3" />
	|        |

Now, suppose the user rotates the rectangle <T> degrees (say 12 degrees):

	 /  \
	/    \		<rect x="10" y="20" width="5" height="3" transform="rotate(12, 12.5, 21.5)" />
	\     \
	 \     \
	  \    /
	   \  /

At this point, to the /user/, this looks like a arbitrary polygon.  However, to the program
it's still a rect (or a circle, or group, or whatever).

So suppose that the user now stretches this "polygon" along the X-axis, not touching the Y
[scale(2.0, 1.0)].  What /kind/ of transform is required to make this work _in general_? 
(the reason I need this to work /in general/ is because the item may be a group which already
has an arbitrary set of transforms applied).

	 _/    \_
	/        \_		<rect x="10" y="20" width="5" height="3" transform="....???.... rotate(12,
12.5, 21.5) ....???....">
	\_         \_
	  \_         \
	    \_      _/
	      \_  _/

I tried pre-concatenating a translate, then concatenating the scale, the concatenating another
translate, but this only seems to work correctly if no prior transforms are there.  Perhaps
I just did something wrong, but if so, what?

Thank you for your help.  And if this is the wrong forum for these types of questions, then
thank you for your forgiveness and patience (and hopefully suggestions on what would be the
right forum ;-).


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

View raw message