Re: Fwd: Question on gradient userSpaceOnUse

Thanks Anthony, I understand what you are saying with respect to the
gradient normal.

It would be really great if the decision on which one is right could be made
sooner rather than later with an official test too.

Unfortunately I came across this issue in trying to implement
non-scaling-stroke in webkit (you're next mozilla!) And trying to compare
results with Opera.  I guess I'll just have to make sure webkit's
implementation is consistent with how gradients are painted there instead of
comparing to another UA.

Jeff

On Jan 7, 2010 6:19 AM, "Anthony Grasso" <anthony.grasso@cisra.canon.com.au>
wrote:

Hi Jeff,

I spent some time a while back tackling this problem. See comments below.

Jeff Schiller wrote: > > Hi www-svg, > > This is an email I forwarded to
Erik Dahlstrom to questio...
I think the wording below [1] is very ambiguous.

[[
If gradientUnits="userSpaceOnUse", 'x1', 'y1', 'x2', 'y2' 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"
]]

The diagrams that Ken and Cyril presented illustrate one vital detail
required for rendering linear gradients which is not present in any of the
SVG specifications. A gradient direction is defined by the vector, but there
is a second component which defines the direction of the stripes on a linear
gradient - the Gradient Normal. Ken's and Cyril's diagrams both show the
Gradient Normal.

The problem is at what point in time the gradient normal is transformed.
>From a technical perspective the two different results are correct (see
both_sides_of_the_coin.png).

Implementation 'A' defines a Gradient Vector and a Gradient Normal prior to
being transformed (A.1). When the transformation is applied both vector and
normal are transformed (A.2).

Implementation 'B' defines a Gradient Vector only prior to being transformed
(B.1). When the transform is applied the vector is transformed (B.2). The
normal is then defined on the gradient (B.3) prior to any gradientTransform
attributes being applied.

Given that the specification is ambiguous about the 'time' a gradient
element is reference and additionally does not define how a gradient normal
works with a gradient vector both implementations are technically correct.
The question then remains which looks better (see real_world_01.png and
real_world_02.png).

This is something that will must be made clear for SVG 2.0, hence an issue
should be raised.

Cheers,

Anthony

[1]
http://www.w3.org/TR/SVGTiny12/painting.html#LinearGradientElement#LinearGradientUnitsAttribute<http://www.w3.org/TR/SVGTiny12/painting.html#LinearGradientElement%23LinearGradientUnitsAttribute>

Received on Thursday, 7 January 2010 14:01:04 UTC