xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "G. Wade Johnson" <gwa...@anomaly.org>
Subject Re: Scaling around a center point...
Date Sat, 10 Dec 2005 01:44:01 GMT
On Fri, 9 Dec 2005 12:38:24 -0500
"Bishop, Michael W. CONTR J9C880" <Michael.Bishop@je.jfcom.mil> wrote:

> Hi,
>      Yeah, I'm learning more about transforms than I really want to.  Oh
>      well, it helps.  Unfortunately, applying a rotate to a transform seems
>      to really screw up scaling AND translating.  Looking at the matrix, it
>      makes sense as to why.  If I draw an element to the JSVGCanvas, and
>      want to be able to move, scale, and rotate it without one operation
>      hosing up another, how do I achieve this?  I had scaling and
>      translating down pat, but rotation breaks everything.

Although it sometimes seems to be overkill, I've often found it simpler to add
a group for this.

<g transform="translate(100, 200)">
   <rect x="-10" y="-20" width="20" height="40"
         transform="rotate( 30 ) scale(5)"/>
</g>

This does seem "inelegant" in that I'm adding a group for the sole purpose of
simplifying my transforms. But, in some cases, I found it easier to go this
route than to work out the other. The thing that makes this most useful is
that the origin point of the rectangle (or whatever) is at it's center, this
makes it rotate about the center and makes scaling much easier.

I've normally only used this when I had a limited number of things to
move/scale/rotate. I'm not sure how well it would scale for large or complex
drawings.

G. Wade


-- 
"The avalanche has already started. It is too late for the pebbles to
vote."                               -- Ambassador Kosh, "Believers"

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


Mime
View raw message