[webkit-dev] Adding blending mode to WebKit canvas

Dirk Schulze dschulze at adobe.com
Sun Nov 11 17:25:48 PST 2012

On Nov 9, 2012, at 4:39 PM, Rik Cabanier <cabanier at gmail.com> wrote:

> Hi,
> I'd like to add support for blending modes to Canvas.
> The spec for this feature can be found here: https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#canvascompositingandblending
> The implementation will be tracked by a meta bug: https://bugs.webkit.org/show_bug.cgi?id=100069
> I also attached a large patch that shows how this feature can be implemented.

Looking at your patches on bug 100069 and bug 101804, I actually have some questions. If I understand your API changes correctly, the 'globalCompositeOperation' property gets more keywords. The new keywords will be the same as for the 'blend-mode' property of the CSS Compositing spec. Does it mean that blend mode always will use the compositing operator 'source-over'?

The example implementation of GraphicsContext::setPlatformCompositeOperation on CG indicates that it would be possible to combine blend modes with different compositing operators in CG already. If you set both with the same property 'globalCompositeOperation', it won't be possible to mix them in the future. If more implementations are capable to support mixing alpha compositing and blending, the property can not be changed anymore. 

Wouldn't it be better to add a new property to canvas for blending? At the beginning, implementations are just require to use different blend modes in combination with 'source-over'. Btw. why is this addition in CSS Compositing and not in the Canvas spec?


> Please let me know of any concerns.
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo/webkit-dev

More information about the webkit-dev mailing list