On Sun, Nov 11, 2012 at 5:25 PM, Dirk Schulze <dschu...@adobe.com> wrote:

>
> On Nov 9, 2012, at 4:39 PM, Rik Cabanier <caban...@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'?
>

Correct.
>From the spec [1]:

Blending is not separated from compositing in canvas 2d. If a blend
operation is selected its results must always be composited with the ‘
source-over’<https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#porterduffcompositingoperators_srcover>
compositing
mode.



>
> 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.


Unfortunately, CG can't do this (yet). The code is written to minimize
change and to make this split easy to implement in the future.


> 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.
>

Well, it can still be changed.
If in the future, people feel the need to specify blending and compositing
separately, we can define a new property (globalBlendOperation?) that
specifies the blending operation before globalCompositeOperation.
If a user specifies a blending operation in both globalBlendOperation
and globalCompositeOperation, we can define that globalCompositeOperation
reverts to source-over.


>
> 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'.


That could work too.
There was a mailing list conversation about this a couple of months ago,
and people were evenly split on the subject.

The vast majority of cases will use 'source-over' in combination with
blending so maybe it's best to keep it simple...



> Btw. why is this addition in CSS Compositing and not in the Canvas spec?
>
>
I got feedback that it was best to specify this in the compositing spec
since it explains in detail how the formulas work and has pretty pictures.
The canvas spec can be changed to refer to the blending spec.

Rik


1:
https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#canvascompositingandblending
_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-dev

Reply via email to