Re: [css3-images] Proposed Gradients changes

On Tue, Nov 23, 2010 at 5:40 PM, Alan Gresley <alan@css-class.com> wrote:
> On 24/11/2010 12:00 PM, Tab Atkins Jr. wrote:
>>
>> On Tue, Nov 23, 2010 at 4:41 PM, Alan Gresley<alan@css-class.com>  wrote:
>>>
>>> This may be true for current display devices that shows a sRGB gamut but
>>> some display devices now can show scRGB. Also future displace devices may
>>> have much better gamma correction.
>>>
>>> I would like to ask you a simple question. At what point does the below
>>> gradient use imaginary colors of scRGB gamut?
>>>
>>> background: linear-gradient(left, rgba(-20, 270, 250), transparent);
>>
>> The transition here is obvious and doesn't care what colors you are
>> specifying.  You just first map both colors into premultiplied color
>> 4-tuples, which gives you (-20,270,250,1) and (0,0,0,0).  Then you do
>> a naive interpolation, and map the results back into sRGB.
>
> Really! What about on a display devices that uses scRGB? Mapping colors from
> scRGB into sRGB will cause the start of the transition to be within the sRGB
> gamut. Is this what we desire with scRGB displace devices?

I don't understand what you're asking about.  It doesn't matter what
color-space you are using originally; all CSS colors must be expressed
in the sRGB colorspace (note - *not necessarily* the gamut defined by
sRGB - you can express out-of-gamut colors using rgb()).

Once it's expressed as a CSS color, then it transitions in the obvious
way, regardless of whether it's in-gamut or out-of-gamut (because we
can't actually know what the gamut of the device is in general; that's
extra information you might have in some situations, but not all).


>> Then, at actual value time, you map any colors outside your device's
>> gamut, if this is known, to colors inside the gamut.  CSS doesn't
>> define how this must be done, and so it is recommended that you only
>> use colors within the gamut defined by sRGB (that is, only colors with
>> components between 0 and 255).
>
> CSS doesn't have to define how it's done. A display device that only shows a
> sRGB gamut will clamp  (-20,270,250)  to  (0,255,250). I'm talking about
> what happens along a gradient in a display device that support a scRGB
> gamut.

Yes, CSS does have to define how it's done.  Clamping each component
is one way to turn of out-of-gamut color into an in-gamut color, but
not the only way.

A gradient on a device with an scRGB gamut works the same as one on a
device with an sRGB gamut, except that possibly the actual value of
the colors will be different, if the browser is aware of the device's
gamut (on an sRGB device, the browser will ensure the actual value of
the color is within the sRGB gamut, while on an scRGB device it can
ensure the actual value of the color is within the scRGB gamut).


>>> Or at what point along the gradient does it become transparent?
>>
>> It becomes transparent at the very end, since you're transitioning
>> from a solid color to full transparency.  Why would you expect this to
>> be different?
>
> Yes I do. I expect the gradient to end (become an imaginary color) before
> the end point of the gradient but the degree that this happens is greater if
> premultiplied gradients are implemented. It may do likewise for
> un-premultiplied gradients.

No, there are no imaginary colors at actual value time.  All colors
are mapped into the device gamut, or into the sRGB gamut if the
browser doesn't have enough information to tell what the device's
gamut is.

This is irrelevant to the question, though.  Why would you think that
an imaginary color would cause the gradient to turn transparent
sooner?  The alpha component transitions separately from the color
components, and transparency is determined *solely* by the alpha
component.

~TJ

Received on Wednesday, 24 November 2010 01:56:44 UTC