W3C home > Mailing lists > Public > www-svg@w3.org > January 2010

Re: Fwd: Question on gradient userSpaceOnUse

From: Alex Danilo <alex@abbra.com>
Date: Tue, 05 Jan 2010 23:20:07 +1100
Message-Id: <JXWRVK.7B2Q793Q3074@abbra.com>
To: Ken Stacey <ken@svgmaker.com>
Cc: www-svg@w3.org
Hi Ken,

--Original Message--:
>I agree with Dirk, the gradient should be perpendicular in user space.
>
>Below is Jeff and Erik's examples extended further to show a 
>perpendicular line in user space.

Cool example, thanks!

>Ken Stacey
>
><?xml version="1.0"?>
><svg xmlns="http://www.w3.org/2000/svg"
>      xmlns:xlink="http://www.w3.org/1999/xlink">
>   <defs>
>     <linearGradient id="g1" x1="0" y1="0" x2="400" y2="50" 
>gradientUnits="userSpaceOnUse">
>       <stop offset="0" stop-color="red"/>
>       <stop offset="0.5" stop-color="green"/>
>       <stop offset="1.0" stop-color="blue"/>
>     </linearGradient>
>     <linearGradient id="g2" x1="0" y1="0" x2="100" y2="50" 
>gradientUnits="userSpaceOnUse">
>       <stop offset="0" stop-color="red"/>
>       <stop offset="0.5" stop-color="green"/>
>       <stop offset="1.0" stop-color="blue"/>
>     </linearGradient>
>   </defs>
>
>   <g transform="translate(100,100)">
>     <g transform="scale(0.25,1)">
>       <rect width="400" height="50" fill="url(#g1)" />
>       <!-- show the gradient vector in current user space -->
>       <line x1="0" y1="0" x2="400" y2="50" stroke="black"/>
>       <!-- show the perpendicular vector in current user space -->
>       <line x1="0" y1="0" x2="400" y2="50" stroke="black" 
>transform="translate(200,25) rotate(-90)"/>
>     </g>
>	</g>
>   <g transform="translate(100,200)">
>     <rect width="100" height="50" fill="url(#g2)" />
>     <!-- show the gradient vector in current user space -->
>     <line x1="0" y1="0" x2="100" y2="50" stroke="black"/>
>       <!-- show the perpendicular vector in current user space -->
>     <line x1="0" y1="0" x2="100" y2="50" stroke="black" 
>transform="translate(50,25) rotate(-90)"/>
>   </g>
></svg>

Looking at the results of this test it seems that some
implementations take the perpendicular from device space,
and some from user space with differing results.

So it looks like the WG need to decide what the expected
behaviour is, and add a test to verify that.

Alex
Received on Tuesday, 5 January 2010 12:20:54 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:25 UTC