W3C home > Mailing lists > Public > www-style@w3.org > August 2011

RE: [css3-images] Radial gradients with a degenerate shape

From: Brian Manthos <brianman@microsoft.com>
Date: Fri, 12 Aug 2011 02:26:37 +0000
To: Tab Atkins Jr. <jackalmage@gmail.com>, www-style list <www-style@w3.org>
Message-ID: <9710FCC2E88860489239BE0308AC5D1711C1B9@TK5EX14MBXC264.redmond.corp.microsoft.com>
It has an impact on the location of non-percentage stop locations by affecting the length of the gradient line segment.

Case A
radial-gradient(center, 10px 10px, red 5px, blue 7px);

Case B
radial-gradient(center, 10px 0px, red 5px, blue 7px);

Case C
radial-gradient(center, 0px 20px, red 5px, blue 7px);

Case D
radial-gradient(center, 0px 0px, red 5px, blue 7px);


I prefer we just stick with the solid last stop rendering:
"You've defined a shape that has no volume.  All point outside that volume has the last color stop."  That makes a lot of sense to me.

For repeating-radial-gradients, you could make an argument for something more interesting (average color) but I'm not sure that's worthwhile.


That said...

If it were to change, say in "css.next: the land of doing different things for bad input with more time to evaluate new proposals", perhaps the rendering should be something like:

A: Non-degenerate case, unchanged.  Fill the box with blue, excluding 5px radius circle in the center which you fill with red.
B: In the center of the box, draw a zero height horizontal red line segment 10px wide, then extend that line segment 2 pixels with blue in both horizontal directions, fill the rest of the box with blue.
C: In the center of the box, draw a zero width vertical red line segment 10px wide, then extend that line segment 2 pixels with blue in both vertical directions, fill the rest of the box with blue.
D: In the center of the box, draw a zero width zero height circle in red.  Then fill the rest of the box with blue.


Unless you zoom in with a zoom factor of infinity, I think B and C and D render the same as "just fill with blue" which is what the spec already said.

-Brian

-----Original Message-----
From: www-style-request@w3.org [mailto:www-style-request@w3.org] On Behalf Of Tab Atkins Jr.
Sent: Thursday, August 11, 2011 6:15 PM
To: www-style list
Subject: [css3-images] Radial gradients with a degenerate shape

Radial gradients can define a "degenerate shape" for their size/shape parameter - a circle or ellipse with 0 radius.

Currently, I'm treating this as an error condition and having them render simply as a solid color equal to the last color-stop.

While doing an editorial rewrite of the radial gradients section, though, I realized that there's no reason to do this.  There is a well-defined "limit rendering" for these kinds of shapes, since the size/shape parameter doesn't scale the stops or anything, it just sets the shape of the gradient.  Degenerate shapes are just vertical or horizontal lines, which is a perfectly reasonable thing - it essentially just makes a linear gradient in the direction of the minor axis, mirrored across the major axis.

Anyone mind me changing this part of the spec so that we can regain image-continuity in this case?

~TJ


Received on Friday, 12 August 2011 02:27:18 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:43 GMT