You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: compositing-2/Overview.bs
+32-32Lines changed: 32 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
-
<h1>Compositing and Blending Level 2</h1>
2
1
<pre class='metadata'>
2
+
Title: Compositing and Blending Level 2
3
+
Group: fxtf
3
4
Status: ED
4
5
ED: https://drafts.fxtf.org/compositing-2/
5
6
TR: https://www.w3.org/TR/compositing-2/
6
-
Previous Version:
7
-
Shortname: compositing level 2
7
+
Previous Version:
8
+
Shortname: compositing
9
+
Level: 2
8
10
Link Defaults: css-color-3 (property) color, svg (property) mask
9
11
Deadline: 2014-08-17
10
-
Level: 2
11
-
Group: fxtf
12
12
Editor: Rik Cabanier, Adobe Systems Inc., cabanier@adobe.com
13
13
Editor: Nikos Andronikos, Canon Information Systems Research Australia, Nikos.Andronikos@cisra.canon.com.au
14
14
Abstract: Compositing describes how shapes of different elements are combined into a single image. There are various possible approaches for compositing. Previous versions of SVG and CSS used <a href="https://www.w3.org/TR/SVG11/masking.html#SimpleAlphaBlending">Simple Alpha Compositing</a>. In this model, each element is rendered into its own buffer and is then merged with its <a>backdrop</a> using the Porter Duff ''source-over'' operator. This specification will define a new compositing model that expands upon the Simple Alpha Compositing model by offering:
@@ -64,7 +64,7 @@ all properties defined in this specification also accept the <a
Note: Applying a blendmode other than <a value>normal</a> to the element must establish a new <a spec="css21">stacking context</a>[[!CSS21]]. This group must then be blended and composited with the <a spec="css21">stacking context</a> that contains the element.
@@ -226,7 +226,7 @@ div { background-image: url('texture.png'); }
226
226
}
227
227
p {
228
228
mix-blend-mode: overlay;
229
-
font-family: "Mythos Std"
229
+
font-family: "Mythos Std"
230
230
}
231
231
</pre>
232
232
@@ -301,7 +301,7 @@ property for that element must be reset to its initial value.
301
301
<p>And the following style rule:</p>
302
302
<pre>
303
303
body { background-color: lime; }
304
-
div {
304
+
div {
305
305
width: 200px;
306
306
height: 200px;
307
307
background-size: 200px 200px;
@@ -362,7 +362,7 @@ Where the graphic element is opaque, it obscures the backdrop and where the grap
362
362
-->
363
363
364
364
In the model described in this specification there are two steps to the overall compositing operation - <a href="#advancedcompositing">Porter-Duff compositing</a> and <a href="#blending">blending</a>.
365
-
<!--Porter Duff compositing takes into account the overall shape of the graphic element and its opacity, as well as the opacity and shape of the backdrop, and
365
+
<!--Porter Duff compositing takes into account the overall shape of the graphic element and its opacity, as well as the opacity and shape of the backdrop, and
366
366
determines where the backdrop is visible, where the graphic element is visible and where one is visible through the other.-->
367
367
The blending step determines how the colors from the graphic element and the backdrop interact.
368
368
@@ -384,7 +384,7 @@ The formula for simple alpha compositing is
384
384
co = Cs x αs + Cb x αb x (1 - αs)
385
385
</pre>
386
386
387
-
Where
387
+
Where
388
388
389
389
<ul>
390
390
<li>co: the premultiplied pixel value after compositing
@@ -399,10 +399,10 @@ Note: All values are between 0 and 1 inclusive.
399
399
The pixel value after compositing (co) is given by adding the contributions from the source graphic element [Cs x αs] and the backdrop [Cb x αb x (1 - αs)].
400
400
For both the graphic element and the backdrop, the color values are multiplied by the alpha to determine the amount of color that contributes.
401
401
With zero alpha meaning that the color does not contribute and partial alpha means that some percentage of the color contributes.
402
-
The contribution of the backdrop is further reduced based on the opacity of the graphic element.
402
+
The contribution of the backdrop is further reduced based on the opacity of the graphic element.
403
403
Conceptually, (1 - αs) of the backdrop shows through the graphic element, meaning that if the graphic element is fully opaque (αs=1) then no backdrop shows through.
404
404
405
-
The simple alpha compositing formula listed above gives a resultant color which is the result of the
405
+
The simple alpha compositing formula listed above gives a resultant color which is the result of the
406
406
weighted average of the backdrop color and graphic element color, with the weighting determined by the backdrop and
407
407
graphic element alphas.
408
408
The resultant alpha value of the composite is simply the sum of the contributed alpha of the composited elements.
@@ -412,7 +412,7 @@ The formula for the resultant alpha of the composite is
412
412
αo = αs + αb x (1 - αs)
413
413
</pre>
414
414
415
-
Where
415
+
Where
416
416
417
417
<ul>
418
418
<li>αo: the alpha value of the composite
@@ -428,7 +428,7 @@ The pre-multiplied value is given by
428
428
<pre>
429
429
cs = Cs x αs
430
430
</pre>
431
-
with
431
+
with
432
432
<ul>
433
433
<li>cs: the pre-multiplied value
434
434
<li>Cs: the color value
@@ -769,7 +769,7 @@ The area of each region can be calculated with the following equations:
769
769
The figure above represents coverage of 0.5 for both source and destination.
770
770
771
771
<pre>
772
-
Both = 0.5 x 0.5 = 0.25
772
+
Both = 0.5 x 0.5 = 0.25
773
773
Source Only = 0.5 (1 – 0.5) = 0.25
774
774
Destination Only = 0.5(1 – 0.5) = 0.25
775
775
None = (1 – 0.5)(1 – 0.5) = 0.25
@@ -900,7 +900,7 @@ Destination which overlaps the source, replaces the source.
900
900
</div>
901
901
<pre>
902
902
Fa = 0; Fb = αs
903
-
co = αb x Cb x αs
903
+
co = αb x Cb x αs
904
904
αo = αb x αs
905
905
</pre>
906
906
@@ -1001,8 +1001,8 @@ Display the sum of the source image and destination image. It is defined in the
1001
1001
<!--<h4 id="groupcompositingisolation">Isolated groups and Porter Duff modes</h4>-->
1002
1002
1003
1003
When compositing the elements within an isolated group, the elements are composited over a transparent black initial backdrop. If the bottom element in the group uses a Porter Duff compositing operator
1004
-
which is dependent on the backdrop, such as <a href="#porterduffcompositingoperators_dst">destination</a>, <a href="#porterduffcompositingoperators_srcin">source-in</a>,
1005
-
<a href="#porterduffcompositingoperators_dstin">destination-in</a>, <a href="#porterduffcompositingoperators_dstout">destination-out</a> or <a href="#porterduffcompositingoperators_srcatop">source-atop</a>,
1004
+
which is dependent on the backdrop, such as <a href="#porterduffcompositingoperators_dst">destination</a>, <a href="#porterduffcompositingoperators_srcin">source-in</a>,
1005
+
<a href="#porterduffcompositingoperators_dstin">destination-in</a>, <a href="#porterduffcompositingoperators_dstout">destination-out</a> or <a href="#porterduffcompositingoperators_srcatop">source-atop</a>,
1006
1006
then the result of the composite will be empty. Subsequent elements within the group are composited with the result of the first composite.
1007
1007
1008
1008
<!--
@@ -1116,7 +1116,7 @@ This is the default attribute which specifies no blending. The blending formula
The source color is multiplied by the destination color and replaces the destination.
1119
+
The source color is multiplied by the destination color and replaces the destination.
1120
1120
1121
1121
The resultant color is always at least as dark as either the source or destination color. Multiplying any color with black results in black. Multiplying any color with white preserves the original color.
1122
1122
@@ -1237,7 +1237,7 @@ Multiplies or screens the colors, depending on the source color value. The effec
1237
1237
if(Cs <= 0.5)
1238
1238
B(Cb, Cs) = Multiply(Cb, 2 x Cs)
1239
1239
else
1240
-
B(Cb, Cs) = Screen(Cb, 2 x Cs -1)
1240
+
B(Cb, Cs) = Screen(Cb, 2 x Cs -1)
1241
1241
</pre>
1242
1242
1243
1243
See the definition of <a value>multiply</a> and <a value>screen</a> for their formulas.
@@ -1311,28 +1311,28 @@ The nonseparable blend mode formulas make use of several auxiliary functions:
1311
1311
1312
1312
<pre>
1313
1313
Lum(C) = 0.3 x Cred + 0.59 x Cgreen + 0.11 x Cblue
0 commit comments