No subject


Wed Aug 1 07:28:53 PDT 2012


Blending is not separated from compositing in canvas 2d. If a blend
operation is selected its results must always be composited with the =91
source-over=92<https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.ht=
ml#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 ca=
n
> 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 th=
e
> 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#canvascompos=
itingandblending

--047d7b603e92752db904ce437d29
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

<br><br><div class=3D"gmail_quote">On Sun, Nov 11, 2012 at 5:25 PM, Dirk Sc=
hulze <span dir=3D"ltr">&lt;<a href=3D"mailto:dschulze at adobe.com" target=3D=
"_blank">dschulze at adobe.com</a>&gt;</span> wrote:<br><blockquote class=3D"g=
mail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-l=
eft:1ex">
<div class=3D"HOEnZb"><div class=3D"h5"><br>
On Nov 9, 2012, at 4:39 PM, Rik Cabanier &lt;<a href=3D"mailto:cabanier at gma=
il.com">cabanier at gmail.com</a>&gt; wrote:<br>
<br>
&gt; Hi,<br>
&gt;<br>
&gt; I&#39;d like to add support for blending modes to Canvas.<br>
&gt; The spec for this feature can be found here: <a href=3D"https://dvcs.w=
3.org/hg/FXTF/rawfile/tip/compositing/index.html#canvascompositingandblendi=
ng" target=3D"_blank">https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/i=
ndex.html#canvascompositingandblending</a><br>

&gt;<br>
&gt; The implementation will be tracked by a meta bug: <a href=3D"https://b=
ugs.webkit.org/show_bug.cgi?id=3D100069" target=3D"_blank">https://bugs.web=
kit.org/show_bug.cgi?id=3D100069</a><br>
&gt; I also attached a large patch that shows how this feature can be imple=
mented.<br>
<br>
</div></div>Looking at your patches on bug 100069 and bug 101804, I actuall=
y have some questions. If I understand your API changes correctly, the &#39=
;globalCompositeOperation&#39; property gets more keywords. The new keyword=
s will be the same as for the &#39;blend-mode&#39; property of the CSS Comp=
ositing spec. Does it mean that blend mode always will use the compositing =
operator &#39;source-over&#39;?<br>
</blockquote><div><br></div><div>Correct.</div><div>From the spec [1]:</div=
></div><blockquote style=3D"margin:0 0 0 40px;border:none;padding:0px"><div=
 class=3D"gmail_quote"><div><span style=3D"color:rgb(31,31,31);font-family:=
DroidSerif,&#39;Droid Serif&#39;,serif;font-size:15px;line-height:25.5px;ba=
ckground-color:rgb(255,255,255)">Blending is not separated from compositing=
 in canvas 2d. If a blend operation is selected its results must always be =
composited with the=A0</span><a href=3D"https://dvcs.w3.org/hg/FXTF/rawfile=
/tip/compositing/index.html#porterduffcompositingoperators_srcover" style=
=3D"color:rgb(70,164,233);background-color:rgb(255,255,255);font-family:Dro=
idSerif,&#39;Droid Serif&#39;,serif;font-size:15px;line-height:25.5px">=91<=
code class=3D"property" style=3D"font-family:DroidSansMonoRegular,&#39;Droi=
d Sans Mono&#39;,Inconsolata,monospace;line-height:1.45em;font:inherit;whit=
e-space:nowrap">source-over</code>=92</a><span style=3D"color:rgb(31,31,31)=
;font-family:DroidSerif,&#39;Droid Serif&#39;,serif;font-size:15px;line-hei=
ght:25.5px;background-color:rgb(255,255,255)">=A0compositing mode.</span></=
div>
</div></blockquote><div class=3D"gmail_quote"><div>=A0</div><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pa=
dding-left:1ex">
<br>
The example implementation of GraphicsContext::setPlatformCompositeOperatio=
n on CG indicates that it would be possible to combine blend modes with dif=
ferent compositing operators in CG already. </blockquote><div><br></div>
<div>Unfortunately, CG can&#39;t do this (yet). The code is written to mini=
mize change and to make this split easy to implement in the future.</div><d=
iv>=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bo=
rder-left:1px #ccc solid;padding-left:1ex">
If you set both with the same property &#39;globalCompositeOperation&#39;, =
it won&#39;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.<br>
</blockquote><div><br></div><div>Well, it can still be changed.</div><div>I=
f in the future, people feel the need to specify blending and compositing s=
eparately, we can define a new property (globalBlendOperation?) that specif=
ies the blending operation before globalCompositeOperation.</div>
<div>If a user specifies a blending operation in both=A0globalBlendOperatio=
n and=A0globalCompositeOperation, we can define that=A0globalCompositeOpera=
tion reverts to source-over.</div><div>=A0</div><blockquote class=3D"gmail_=
quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1=
ex">

<br>
Wouldn&#39;t it be better to add a new property to canvas for blending? At =
the beginning, implementations are just require to use different blend mode=
s in combination with &#39;source-over&#39;. </blockquote><div><br></div>
<div>That could work too.</div><div>There was a mailing list conversation a=
bout this a couple of months ago, and people were evenly split on the subje=
ct.</div><div><br></div><div>The vast majority of cases will use &#39;sourc=
e-over&#39; in combination with blending so maybe it&#39;s best to keep it =
simple...</div>
<div><br></div><div>=A0</div><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Btw. why is thi=
s addition in CSS Compositing and not in the Canvas spec?<br>
<br></blockquote><div><br></div><div>I got feedback that it was best to spe=
cify this in the compositing spec since it explains in detail how the formu=
las work and has pretty pictures.=A0</div><div>The canvas spec can be chang=
ed to refer to the blending spec.</div>
<div><br></div><div>Rik</div><div>=A0</div><div><br></div><div>1: <a href=
=3D"https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#canvasco=
mpositingandblending">https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/i=
ndex.html#canvascompositingandblending</a></div>
<div>=A0</div></div><br>

--047d7b603e92752db904ce437d29--


More information about the webkit-dev mailing list