W3C home > Mailing lists > Public > www-svg@w3.org > December 2004

RE: SVG 1.1 Spec Rec - 7.6 The Transform Attribute

From: Jon Ferraiolo <jon.ferraiolo@adobe.com>
Date: Thu, 23 Dec 2004 10:33:25 -0800
To: pegan@gresham-forms.co.uk, chris@w3.org
Cc: www-svg@w3.org
Message-id: <>
Transformations can get confusing if you attempt to explain them in 
simplistic term. Regarding your question, the SVG 1.1 specification is 
fairly clear about this in 
http://www.w3.org/TR/SVG11/coords.html#TransformAttribute. It says:

    <rect x="10" y="10" width="20" height="20" transform="scale(2)"/>

is equivalent to:

    <g transform="scale(2)">
      <rect x="10" y="10" width="20" height="20"/>

and then that:

   <g transform="translate(-10,-20) scale(2) rotate(45) translate(5,10)">
     <!-- graphics elements go here -->

is equivalent to:

   <g transform="translate(-10,-20)">
     <g transform="scale(2)">
       <g transform="rotate(45)">
         <g transform="translate(5,10)">
           <!-- graphics elements go here -->

Therefore, your example:
><rect width="30" height="30" fill="orange" transform="translate(200,0) 

is equivalent to:

   <g transform="translate(200,0)">
      <g transform="rotate(45)">
         <rect width="30" height="30" fill="orange"/>

Jon Ferraiolo
Adobe Systems, Inc.
SVG 1.0 Editor

At 04:49 AM 12/23/2004, pegan@gresham-forms.co.uk wrote:

>Hi Chris,
>Thanks for the link.
>I have convinced myself that transforms are applied in the 'provided 
>order' (left to right?). I have also just convinced myself that Batik and 
>ASV6 are applying transforms left to right (also in the provided order ?).
>In the case of say :-
><?xml version="1.0" encoding="UTF-8"?>
><svg width="100%" height="100%" 
>     <rect width="30" height="30" fill="orange" 
> transform="translate(200,0) rotate(45)"/>
>The translate is performed first (origin moves to 200,0) then the rotation 
>of the rectangle at the new origin, thus order is left to right according 
>to the spec and processed by Batik and ASV as per spec.
>In the graphics primer you say 'the transform which is applied first 
>appears closest to the vector'. Is the transform that is closest to the 
>vector(s) the first (ie. leftmost) or the last (ie.rightmost) in the 
>transform list ? At the moment I just don't get the right to left bit.
>Kind Regards,
>-----Original Message-----
>From: Chris Lilley [<mailto:chris@w3.org>mailto:chris@w3.org]
>Sent: 23 December 2004 10:43
>To: pegan@gresham-forms.co.uk
>Cc: www-svg@w3.org
>Subject: Re: SVG 1.1 Spec Rec - 7.6 The Transform Attribute
>On Thursday, December 16, 2004, 6:16:48 PM, pegan wrote:
>pgfcu> Hi SVG  WG,
>pgfcu> According to 1.1  spec :-
>pgfcu> "The value of the transform attribute is a
>pgfcu> <transform-list>,  which is defined as a list of transform
>pgfcu> definitions, which are applied in the  order provided".
>pgfcu> The transform definitions seem to be applied in the
>pgfcu> reverse order to the provided order (ie. right to left) in ASV6
>pgfcu> and Batik.
>Yes, they are. To understand why that is correct, you need to look into
>matrix math a little, in particular to understand the terms premultiply
>and postmultiply. I suggest having a look at a computer graphics primer
>on geometry, (just the first chapter), which I wrote a while ago:
>  Chris Lilley                    <mailto:chris@w3.org>mailto:chris@w3.org
>  Chair, W3C SVG Working Group
>  Member, W3C Technical Architecture Group
>Important - This e-mail and the information that it contains may be
>confidential, legally privileged and protected by law. Access by the
>intended recipient only is authorised. Any liability (in negligence or
>otherwise) arising from any third party acting, or refraining from acting,
>on any information contained in this e-mail is hereby excluded. If you are
>not the intended recipient, please notify the sender immediately and do not
>disclose the contents to any other person, use it for any purpose, or store
>or copy the information in any medium. Copyright in this e-mail and
>attachments created by us belongs to STR Gresham Business Forms Ltd the
>also asserts the right to be identified as such and object to any misuse.
Received on Thursday, 23 December 2004 19:02:24 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:01 UTC