Re: [css3-images] Premultiplication switch

On 29/07/2011 3:01 AM, Brian Manthos wrote:
> Leif Arne Storset:

>> Then again, if the author knows enough about premultiplication to care,
>> he
>> or she (or the editor) is probably knowledgeable enough to just code
>> everything unpremultiplied. (As I far as I can see premultiplying is
>> only
>> done so authors can use the intuitive "transparent" keyword - it
>> doesn't
>> enable any additional effects.)
>
>
> At the F2F, Elika hinted at one issue:
>
> Premultiplied
>  linear-gradient(red, transparent, blue);
> Nonpremultiplied
>  linear-gradient(red, rgba(255,0,0,0) 50%, rgba(0,0,255,0) 50%, blue);


There are other ways to do the non-premultiplied version with one single 
midpoint color stop.


    linear-gradient(red, rgba(0,0,0,0), blue);

    linear-gradient(red, rgba(255,255,255,0), blue);

    linear-gradient(red, rgba(255,0,255,0), blue)

    linear-gradient(red, rgba(127,0,127,0), blue)


The way Opera interpolates this gradient,

    linear-gradient(red, transparent, blue)


suggest that internally, a double color stop (as shown below) is generated.

    rgba(255,0,0,0) 50%, rgba(0,0,255,0) 50%


So in affect, the keyword 'transparent' is already behaving as a switch.


> That's a simple enough translation.
>
> Now do it with animations...
> Premultiplied
>  from - linear-gradient(red, transparent, blue);
>  to - linear-gradient(black, transparent, green);
>  
> Nonpremultiplied
>  from - linear-gradient(red, rgba(255,0,0,0) 50%, rgba(0,0,255,0) 50%, blue);
>  to - linear-gradient(black, rgba(0,0,0,0) 50%, rgba(0,255,0,0) 50%, green);


I see this as the real issue that this debate is about. Interpolation 
between gradients of different colors. I see know reason why authors 
should not be able to have such interpolation between different 
gradients done in premutiplied space.

As I see it, 'transparent' is already behaving as a switch but Opera and 
IE10 does one better in using rgba(0,0,0,0), rgba(255,255,255,0) and all 
the the other transparent color points as switches. I see no reason for 
such a behavior to happen.

I would rather see 'transparent' within a gradient act as the switch 
from non-premultiplied to premultiplied space. If this was done, then I 
do believe (with my limited understanding the internal workings of UAs) 
there would be no issues or problems to solve.


> Furthermore, when currentColor is involved in your
> gradient there is no way to translate from
> premultiplied to nonpremultiplied.  You'd need
> something like color-variant-opacity(currentColor, 0%)
> as a<color>.


Just simply not allow translation from premultiplied to nonpremultiplied.



-- 
Alan Gresley
http://css-3d.org/
http://css-class.com/

Received on Friday, 29 July 2011 12:40:04 UTC