W3C home > Mailing lists > Public > public-svg-wg@w3.org > July to September 2011

About current gradients (Re: minutes, SVG WG Seattle F2F 2011 day 3)

From: Cyril Concolato <cyril.concolato@telecom-paristech.fr>
Date: Thu, 04 Aug 2011 17:36:32 +0200
Message-ID: <4E3ABC80.1060502@telecom-paristech.fr>
To: public-svg-wg@w3.org
Le 30/07/2011 07:38, Cameron McCormack a écrit :
> current gradient issues.
> <trackbot> Created ACTION-3097 - Propose wording for the edge case
> where a radialGradient's focal point sits on the edge of the circle
> and the gradient repeats. the spec. should say that when the focal
> point is on the circle edge, with repeat, then the distance between
> the first and last stop for the repeating colors is 0 and the paint
> should generate a color that is the average of all the gradient
> stops. [on Erik Dahlström - due 2011-08-05].
I don't understand this action and the associated resolution.
Looking at the SVG 1.1 2nd Ed, and unless I missed some text, there's only a picture showing what it should look like. So it's not very clear how a gradient should be drawn:
a) inside the gradient circle,
b) outside the circle going from the focal point to the center and away
c) outside the circle going from the focal point opposite to the center.

For the inside of the gradient circle, I believe that the definition from the Canvas spec [1] is mathematically what SVG players do (except for the fr, see below). I think that definition would work also for pixels outside the gradient circle, but opposite of the focal point from the center (case b). For case, c) I don't think there's a defined behavior. We could decide to fill the rest with the last stop color or we could decide to flip the content with of the half-plane separated by the normal to the center-focal vector.

I've made two examples showing how the gradients are built. Have a look here:

[1] http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-createradialgradient

> fr attribute on radialGradients
> ed: canvas can define the inner circle that the radial gradient
> focuses on. SVG could/should align to that by adding an fr attribute
> to control the focal radius.
> ... fr would define where you would hav the zero offset for stops.
> RESOLUTION: add an fr attribute to <radialGradient> for SVG 2.0.
I believe it can already be done with the first stop color being equal to the second stop color, the second stop having a proper offset (computed from r1,r2,x1,x2,y1,y2), no?

Cyril Concolato
Maître de Conférences/Associate Professor
Groupe Multimedia/Multimedia Group
Telecom ParisTech
46 rue Barrault
75 013 Paris, France
Received on Thursday, 4 August 2011 15:36:27 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:29:46 UTC