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

RE: [css3-images] Premultiplication switch (was: gradient pre-multiplied interpolation)

From: Brian Manthos <brianman@microsoft.com>
Date: Thu, 28 Jul 2011 17:01:59 +0000
To: Leif Arne Storset <lstorset@opera.com>, Brad Kemper <brad.kemper@gmail.com>
CC: "www-style@w3.org" <www-style@w3.org>
Message-ID: <9710FCC2E88860489239BE0308AC5D1710AB52@TK5EX14MBXC264.redmond.corp.microsoft.com>
Leif Arne Storset:
> Brad Kemper <brad.kemper@gmail.com> skreiv Thu, 28 Jul 2011 01:49:14
> +0200
> 
> > On Jul 27, 2011, at 2:53 PM, Brian Manthos <brianman@microsoft.com>
> > wrote:
> >
> >> I meant an example usage, but that's good enough for now.
> >>
> >> I'd rather see the interpolation specified in the gradient
> >> specification itself.
> >>
> >> Doing it as part of the gradient itself would allow for varying the
> >> interpolation mode across layers of a background-image
> specification,
> >> whereas doing it as a separate property wouldn't allow that.  Unless
> of
> >> course you want to make color-interpolation a layered property as
> >> well...
> >
> > That strikes me as a very good point. An author who who wants this
> level
> > of control over whether or not to premultiply might also want to
> control
> > it on a background layer by background layer basis.
> 
> 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);

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);

Add more color stops and it gets more cumbersome.



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>.
Received on Thursday, 28 July 2011 17:02:27 GMT

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