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

Re: [css3-images] too-small repeating gradients

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 3 Aug 2011 16:41:57 -0700
Message-ID: <CAAWBYDAsvg9QkGx6LuRsrFr-Ta89_qkaKiZEH3UQCdt__Oh3Pw@mail.gmail.com>
To: Brian Manthos <brianman@microsoft.com>
Cc: www-style list <www-style@w3.org>
On Wed, Aug 3, 2011 at 4:20 PM, Brian Manthos <brianman@microsoft.com> wrote:
> Tab:
>> 1. Changed the handling of too-small repeating gradients to render as the average color.
>
> http://dev.w3.org/csswg/css3-images/#color-stop-syntax
>
> The 8/2 version has two descriptions:
>
> (A)
> repeating-linear-gradient(red 5px, white 5px, blue 5px);
> # If the distance between the first and last color-stops is zero,
> # the gradient must be rendered as a solid-color image equal
> # to the "average" color of the gradient, determined by linearly
> # blending the colors of all the color-stops in premultipied sRGBA space.
>
> (B)
> repeating-linear-gradient(red 5px, white, blue 5.00000000000000000000000000000000000000000000000000000000000001px);
> (Algorithm described)
>
>
> I believe that...
>
> For case (A) the expected result is equal contributions from red, white, and blue.
> For case (B), the expected result is 25% red, 50% white, and 25% blue contributions.
>
> If this is correct, there is a discontinuity between (A) and (B).
>
> Questions:
> (1) Is my interpretation of the language incorrect?
> (2) If no to (1), I prefer (B) and suggest an adjustment to the language for case (A) so that it produces the same result as case (B).

Your interpretation is correct.  I see the problem, though, and can
adjust the Case A language so that the first and last color-stop
contribute at half-weight.

(Even with this change there's a discontinuity when rounding errors
occur, but I can't help that - you either have a discontinuity there
(when you lose the relative positions of things) or you have one when
you go from "wide enough" to "too narrow" on devices with sufficient
resolution to show moire patterns.


> [Minor note courtesy of spell-checker: "premultipied" is missing the second L in the spec phrasing for case A.]

Mmm, multipies.  Fixed!

(I also added an example for each of the types of degenerate repeating
gradients.)

~TJ
Received on Wednesday, 3 August 2011 23:42:44 GMT

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