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

Re: [css-compositing] How do 'alpha-compositing' and 'blend-mode' interact?

From: Maciej Stachowiak <mjs@apple.com>
Date: Wed, 25 Jul 2012 21:41:22 -0700
Cc: www-style list <www-style@w3.org>
Message-id: <2F09AE34-AFE4-42B1-9227-85912A3EEFBA@apple.com>
To: Rik Cabanier <cabanier@gmail.com>

On Jul 21, 2012, at 1:17 PM, Rik Cabanier <cabanier@gmail.com> wrote:

> Hi Maciej,
> 
> 
> On Sat, Jul 21, 2012 at 11:21 AM, Maciej Stachowiak <mjs@apple.com> wrote:
> 
> How do 'alpha-compositing' and 'blend-mode' interact if you have set both? I was unable to determine this from the spec. Does it actually make sense to specify both to non-default values at the same time? I was unable to understand what their relationship is supposed to be.
> 
> blending and compositing are 2 separate operations.
> Blending takes the foreground and background pixels, mixes them together and produces a new image.
> This image is then composited with whatever compositing mode you have set.
> 
> The 2 operations do not interact.

They are both defined in terms of a function, a source color, a background color, and a result color. What happens when both are specified? Do you blend first, and then use that result to composite? It sounds like that's what you are saying, but I don't think that is spelled out in the spec.

This needs to be clearly spelled out in the spec. Please consider this a comment on the spec.

> 
> Most implementations (including Apple's core graphics and Adobe PDF) always assume 'src-over' after blending. 

Is that what the spec will require?

> 
> Some other comments:
> 
> - The property values for the 'alpha-compositing' operator are inconsistent with the values for HTML5 Canvas: <http://www.w3.org/TR/2dcontext/#dom-context-2d-globalcompositeoperation>. I suggest making them match if there is no compelling advantage to the new names, otherwise this will be needlessly confusing to authors.
> 
> That's correct. We reused the names that were in the SVG compositing spec.
> It think we can make them longer, but I'd prefer to keep 'plus' instead of 'lighter' because 'lighter' sounds too much like the 'lighten' blend mode. 'clear' also seems absent in the canvas spec...

I think consistency with the HTML5 Canvas spec outweighs consistency with the old SVG compositing spec (which I don't think was ever implemented in browsers). I also think consistency outweighs fine-tuning the names to be more clear. Adding a new mode is fine, but I'd suggest proposing it for canvas as well. I think it would be confusing for authors if the names are different. Let's not make the newly introduced names different.

> 
> - Consider renaming 'alpha-compositing' to 'composite-operator' for similar reasons.
> 
>  
> 'alpha-compositing' was a suggestion from Chris Marrin and people on the mailing list liked it so I added it to the spec. (It was originally 'comp-op') 

I think alpha-compositing is a bad name because:

1) "alpha" is redundant, we don't have any non-alpha compositing.
2) "alpha-compositing" or "compositing" is ambiguous without a value - does this turn compositing on/off, does it specify the alpha, or does it specify the operator? It's not clear from the name. "composite-operator" or "compositing-operator" are not ambiguous in this way.
3) Consistency with HTML5 Canvas seems valuable to me, more so than crafting the most aesthetically pleasing name.

Is there a way for me to make sure the CSS WG considers these spec comments? Should I file bugs?

Regards,
Maciej
Received on Thursday, 26 July 2012 04:41:55 GMT

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