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 Bibek Sahu <sc...@dodds.net> on 2004/01/07 19:43:27 UTC
graphics transforms
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 ;-).
Ciao,
Bibek
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: graphics transforms
Posted by Thomas DeWeese <Th...@Kodak.com>.
Bibek Sahu wrote:
> 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? :-)]
I don't mind questions on SVG too much in this list, but another
good forum is the 'svg-developers' forum in yahoo-groups. This sort
of question is asked all the time there.
> 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?
You need to preconcatenate everything:
transform="translate(12.5, 21.5) scale(2,1) translate(-12.5, -21.5) ..."
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org