Re: several messages about radial gradients

On Fri, 26 Oct 2007, Anne van Kesteren wrote:
> 
> We don't like the algorithm given for radial gradients. We think it 
> would be better if it was more like in SVG. To quote from an internal 
> discussion: "IMO having an inner circle that goes outside the outer 
> circle is a bug in the script and I would prefer to just throw an error 
> if that happens. That would probably make it a lot easier to for 
> everyone to have a conforming implementation. In svg they have a focus 
> point instead of inner circle, and if the focus point is outside the 
> outer circle it is moved to the edge of the outer circle. That is 
> something that makes a lot more sense to me." Keeping them the same also 
> enables code sharing which seems like a good thing.

On Sat, 27 Oct 2007, Philip Taylor wrote:
>
> Both SVG behaviours can be emulated using the canvas behaviour. When one 
> circle is inside the other, the canvas behaviour can be emulated using 
> the SVG 1.1 behaviour (with some adjustments to colour stop offsets). So 
> it should be possible to share most of the code between canvas and SVG 
> implementations despite them having different APIs/algorithms, but the 
> one-circle-not-inside-the-other case makes it harder. (Firefox uses the 
> same Cairo functions for radial gradients in canvas and SVG, but it 
> doesn't follow the canvas spec for one-circle-not-inside.)

Ok, so the initial argument -- that we should change to match SVG in order 
to help implementations -- seems to be a non-issue.


> Adopting SVG 1.1's focal-point-is-forced-inside-circle behaviour, 
> extended to handle two circles, does sound reasonable to me - the 
> smaller circle (xs,ys) can just be moved towards the larger circle 
> (xl,yl) so that hypot(xs-xl, ys-yl) <= rl-rs, and areas outside the 
> larger circle can be always painted in the colour of that circle. That 
> should be easy to add to the existing implementations, and wouldn't 
> require any changes in the low-level rendering code.

Isn't this strictly a subset of what is possible now?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 1 February 2008 05:58:25 UTC