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

Fwd: Question on gradient userSpaceOnUse

From: Jeff Schiller <codedread@gmail.com>
Date: Mon, 4 Jan 2010 23:21:19 -0600
Message-ID: <da131fde1001042121o3ae61934jafe3594a9c264915@mail.gmail.com>
To: www-svg <www-svg@w3.org>
Hi www-svg,

This is an email I forwarded to Erik Dahlstrom to question about Opera
behavior, but thought it appropriate for general SVG WG discussion.
Consider the following sample:


<?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="100" x2="100" y2="150"
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)">
 <rect width="400" height="50" fill="url(#g1)" transform="scale(0.25,1)"/>
 <rect y="100" width="100" height="50" fill="url(#g2)" />
</g>

</svg>

In the above test, Firefox, WebKit and Batik show the top gradient as
nearly horizontal while Opera shows the two gradients identically.

The spec says userSpaceOnUse "shall represent values in the coordinate
system that results from taking the current user coordinate system in
place at the time when the gradient element is referenced".

Can someone please clarify what is the correct behavior here?

Thanks,
Jeff
Received on Tuesday, 5 January 2010 05:21:51 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:44 GMT