Skip to content

Commit 7040aca

Browse files
dirkschulzesvgeesus
authored andcommitted
Merge pull request w3c#381 from Manishearth/bikeshedify
Use bikeshed links for blend modes
1 parent 1c07f85 commit 7040aca

1 file changed

Lines changed: 43 additions & 34 deletions

File tree

compositing-2/Overview.bs

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ Abstract: <ul><li>additional Porter Duff compositing operators</li><li>advanced
1818
Abstract: In addition, this specification will define CSS properties for blending and group isolation and the properties of the {{globalCompositeOperation}} attribute.
1919
</pre>
2020

21+
22+
<pre class="link-defaults">
23+
spec: css2;
24+
type: dfn; text: stacking context
25+
spec: css-cascade-3
26+
type: dfn; text: inherit
27+
spec: css-position-3;
28+
type: dfn; text: containing block
29+
</pre>
2130
<style type="text/css">
2231
a[data-link-type=element]::before,span[data-link-type=element]::before {
2332
content: '<';
@@ -41,10 +50,9 @@ Each section of this document is normative unless otherwise specified.
4150

4251
This specification defines a set of CSS properties that affect the visual rendering of elements to which
4352
those properties are applied; these effects are applied after elements have been sized and positioned according
44-
to the <a href="https://www.w3.org/TR/CSS2/visuren.html" title="Visual formatting model">Visual formatting model</a>
45-
from [[!CSS21]]. Some values of these properties result in the creation of a
46-
<a href="https://www.w3.org/TR/CSS2/visuren.html#containing-block" title="Visual formatting model">containing block</a>,
47-
and/or the creation of a <a spec="css21">stacking context</a>.
53+
to the [[css2#visual-model-intro|Visual formatting model]]. Some values of these properties result in the creation of a
54+
[=containing block=],
55+
and/or the creation of a [=stacking context=].
4856

4957
The 'background-blend-mode' property also builds upon the properties defined in the <a href="https://www.w3.org/TR/css3-background/#placement" title="Backgrounds and Borders">CSS Backgrounds and Borders</a> module [[!CSS3BG]].
5058

@@ -55,16 +63,15 @@ This module also extends the
5563

5664
<h3 id="values">Values</h3>
5765

58-
This specification follows the <a href="https://www.w3.org/TR/CSS21/about.html#property-defs">CSS property
59-
definition conventions</a> from [[!CSS21]]. Value types not defined in
66+
This specification follows the [[css2#property-defs|CSS property
67+
definition conventions]]. Value types not defined in
6068
this specification are defined in CSS Level 2 Revision 1 [[!CSS21]]. Other CSS
6169
modules may expand the definitions of these value types: for example [[!CSS3COLOR]],
6270
when combined with this module, expands the definition of the &lt;color>
6371
value type as used in this specification.
6472

6573
In addition to the property-specific values listed in their definitions,
66-
all properties defined in this specification also accept the <a
67-
href="https://www.w3.org/TR/CSS21/cascade.html#value-def-inherit">inherit</a>
74+
all properties defined in this specification also accept the [=inherit=]
6875
keyword as their property value. For readability it has not been repeated
6976
explicitly.
7077

@@ -76,11 +83,11 @@ The compositing model must follow the <a href="https://www.w3.org/TR/SVG11/rende
7683
<h3 id="csscompositingrules_CSS">Behavior specific to HTML</h3>
7784
<!-- <p>
7885
If an element specifies non-default blending or <a href="https://www.w3.org/TR/css3-color/#transparency">'opacity'</a>, its <a href="https://www.w3.org/TR/css3-2d-transforms/#transform-style-property">transform-style</a> [[CSS3-TRANSFORMS]] and that of all of its children must revert to 'flat'.<br>
79-
The application of blending other than 'normal' to an element must also establish a <a spec="css21">stacking context</a> [[!CSS21]] the same way that CSS <a href="https://www.w3.org/TR/css3-color/#transparency">'opacity'</a> does. One of the consequences is that elements with z-index must not honor the depth of elements outside of the group.<br> -->
86+
The application of blending other than 'normal' to an element must also establish a [=stacking context=] the same way that CSS <a href="https://www.w3.org/TR/css3-color/#transparency">'opacity'</a> does. One of the consequences is that elements with z-index must not honor the depth of elements outside of the group.<br> -->
8087

81-
Everything in CSS that creates a <a href="https://www.w3.org/TR/CSS21/zindex.html">stacking context</a> must be considered an <a href="#isolatedgroups">‘isolated’ group</a>. HTML elements themselves should not create groups.
88+
Everything in CSS that creates a [=stacking context=] must be considered an <a href="#isolatedgroups">‘isolated’ group</a>. HTML elements themselves should not create groups.
8289

83-
An element that has blending applied, must blend with all the underlying content of the <a spec="css21">stacking context</a> [[!CSS21]] that that element belongs to.
90+
An element that has blending applied, must blend with all the underlying content of the [=stacking context=] that that element belongs to.
8491

8592
<h3 id="csscompositingrules_SVG">Behavior specific to SVG</h3>
8693

@@ -123,7 +130,7 @@ The syntax of the property of <<blend-mode>> is given with:
123130
<a value>color-burn</a> | <a value>hard-light</a> | <a value>soft-light</a> | <a value>difference</a> | <a value>exclusion</a> | <a value>hue</a> |
124131
<a value>saturation</a> | <a value>color</a> | <a value>luminosity</a></pre>
125132

126-
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.
133+
Note: Applying a blendmode other than <a value>normal</a> to the element must establish a new [=stacking context=]. This group must then be blended and composited with the [=stacking context=] that contains the element.
127134

128135
<div class="example">
129136
<p>Given the following sample markup:</p>
@@ -246,7 +253,7 @@ Text with a blend overlay on top of an image.
246253
In SVG, this defines whether an element is isolated or not.<br>
247254
For CSS, setting 'isolation' to ''isolation/isolate'' will turn the element into a stacking context.
248255

249-
By default, elements use the ''isolation/auto'' keyword which implies that they are not isolated. However operations that cause the creation of stacking context [[!CSS21]] must cause a group to be isolated. These operations are described in <a href="#csscompositingrules_CSS">'behavior specific to HTML'</a> and <a href="#csscompositingrules_SVG">'behavior specific to SVG'</a>.
256+
By default, elements use the ''isolation/auto'' keyword which implies that they are not isolated. However operations that cause the creation of [=stacking context=] must cause a group to be isolated. These operations are described in <a href="#csscompositingrules_CSS">'behavior specific to HTML'</a> and <a href="#csscompositingrules_SVG">'behavior specific to SVG'</a>.
250257

251258
<pre class='propdef'>
252259
Name: isolation
@@ -352,7 +359,7 @@ This property takes the following value:
352359

353360
The syntax of the property of <<composite-mode>> is given with:
354361

355-
<pre class="compositemode prod"><dfn id="compositemode">&lt;composite-mode></dfn> = <a href="#porterduffcompositingoperators_clear">clear</a> | <a href="#porterduffcompositingoperators_src">copy</a> | <a href="#porterduffcompositingoperators_srcover">source-over</a> | <a href="#porterduffcompositingoperators_dstover">destination-over</a> | <a href="#porterduffcompositingoperators_srcin">source-in</a> | <br><a href="#porterduffcompositingoperators_dstin">destination-in</a> | <a href="#porterduffcompositingoperators_srcout">source-out</a> | <a href="#porterduffcompositingoperators_dstout">destination-out</a> | <a href="#porterduffcompositingoperators_srcatop">source-atop</a> | <br><a href="#porterduffcompositingoperators_dstatop">destination-atop</a> | <a href="#porterduffcompositingoperators_xor">xor</a> | <a href="#porterduffcompositingoperators_plus">lighter</a> | <a href="#porterduffcompositingoperators_plus_darker">plus-darker</a> | <a href="#porterduffcompositingoperators_plus_lighter">plus-lighter</a></pre>
362+
<pre class="compositemode prod"><dfn id="compositemode">&lt;composite-mode></dfn> = <a>clear</a> | <a>copy</a> | <a>source-over</a> | <a>destination-over</a> | <a>source-in</a> | <br><a>destination-in</a> | <a>source-out</a> | <a>destination-out</a> | <a>source-atop</a> | <br><a>destination-atop</a> | <a>xor</a> | <a>lighter</a> | <a>plus-darker</a> | <a>plus-lighter</a></pre>
356363

357364
<h2 id="whatiscompositing">Introduction to compositing</h2>
358365

@@ -723,7 +730,7 @@ which is the color value ultimately displayed by the UA.
723730
-->
724731
<h2 id="advancedcompositing">Advanced compositing features</h2>
725732

726-
<a href="#simplealphacompositing">Simple alpha compositing</a> uses the <a href="#porterduffcompositingoperators_srcover">source-over</a> Porter Duff compositing operator. <!-- Additional compositing operators exist and may be specified with the <a href="#propdef-mix-composite">mix-composite property</a>.
733+
<a href="#simplealphacompositing">Simple alpha compositing</a> uses the [=source-over=] Porter Duff compositing operator. <!-- Additional compositing operators exist and may be specified with the <a href="#propdef-mix-composite">mix-composite property</a>.
727734
The additional compositing operators allow for more complex interactions between the shapes of elements being composited. The compositing operators are described in the <a href="#porterduffcompositingoperators">Porter Duff compositing operators</a>.
728735
The operators that applies to an element or group is selected using the <a href="#propdef-mix-composite">mix-composite</a> property.-->
729736

@@ -816,7 +823,7 @@ Where:
816823

817824
<h4 id="porterduffcompositingoperators_clear">Clear</h4>
818825

819-
No regions are enabled.
826+
With the <dfn>clear</dfn> compositing operator, no regions are enabled.
820827

821828
<div class="figure">
822829
<img src="examples/PD_clr.svg" alt="example of porter duff clear"/>
@@ -828,7 +835,7 @@ No regions are enabled.
828835
αo = 0
829836
</pre>
830837
<h4 id="porterduffcompositingoperators_src">Copy</h4>
831-
<p>Only the source will be present.</p>
838+
With the <dfn>copy</dfn> compositing operator, only the source will be present.
832839
<div class="figure">
833840
<img src="examples/PD_src.svg" alt="example of porter duff copy"/>
834841
<p class="caption"></p>
@@ -841,7 +848,7 @@ No regions are enabled.
841848

842849
<h4 id="porterduffcompositingoperators_dst">Destination</h4>
843850

844-
Only the destination will be present.
851+
With the <dfn>destination</dfn> compositing operator, only the destination will be present.
845852

846853
<div class="figure">
847854
<img src="examples/PD_dst.svg" alt="example of porter duff destination"/>
@@ -855,7 +862,7 @@ Only the destination will be present.
855862

856863
<h4 id="porterduffcompositingoperators_srcover">Source Over</h4>
857864

858-
Source is placed over the destination.
865+
With the <dfn>source-over</dfn> compositing operator, the source is placed over the destination.
859866

860867
<div class="figure">
861868
<img src="examples/PD_src-over.svg" alt="example of porter duff source over"/>
@@ -868,7 +875,7 @@ Source is placed over the destination.
868875
</pre>
869876
<h4 id="porterduffcompositingoperators_dstover">Destination Over</h4>
870877

871-
Destination is placed over the source.
878+
With the <dfn>destination-over</dfn> compositing operator, Destination is placed over the source.
872879

873880
<div class="figure">
874881
<img src="examples/PD_dst-over.svg" alt="example of porter duff destination over"/>
@@ -882,7 +889,7 @@ Destination is placed over the source.
882889

883890
<h4 id="porterduffcompositingoperators_srcin">Source In</h4>
884891

885-
The source that overlaps the destination, replaces the destination.
892+
With the <dfn>source-in</dfn> compositing operator, the parts of the source that overlap with the desitnation are placed.
886893

887894
<div class="figure">
888895
<img src="examples/PD_src-in.svg" alt="example of porter duff source in"/>
@@ -895,7 +902,7 @@ The source that overlaps the destination, replaces the destination.
895902
</pre>
896903

897904
<h4 id="porterduffcompositingoperators_dstin">Destination In</h4>
898-
Destination which overlaps the source, replaces the source.
905+
With the <dfn>destination-in</dfn> compositing operator, the parts of the destination that overlap with the source are placed.
899906

900907
<div class="figure">
901908
<img src="examples/PD_dst-in.svg" alt="example of porter duff destination in "/>
@@ -909,7 +916,7 @@ Destination which overlaps the source, replaces the source.
909916

910917
<h4 id="porterduffcompositingoperators_srcout">Source Out</h4>
911918

912-
Source is placed, where it falls outside of the destination.
919+
With the <dfn>source-out</dfn> compositing operator, the parts of the source that fall outside of the destination are placed.
913920

914921
<div class="figure">
915922
<img src="examples/PD_src-out.svg" alt="example of porter duff source out"/>
@@ -923,7 +930,7 @@ Source is placed, where it falls outside of the destination.
923930

924931
<h4 id="porterduffcompositingoperators_dstout">Destination Out</h4>
925932

926-
Destination is placed, where it falls outside of the source.
933+
With the <dfn>destination-out</dfn> compositing operator, the parts of the destination that fall outside of the source are placed.
927934

928935
<div class="figure">
929936
<img src="examples/PD_dst-out.svg" alt="example of porter duff destination out"/>
@@ -937,7 +944,7 @@ Destination is placed, where it falls outside of the source.
937944

938945
<h4 id="porterduffcompositingoperators_srcatop">Source Atop</h4>
939946

940-
Source which overlaps the destination, replaces the destination. Destination is placed elsewhere.
947+
With the <dfn>source-atop</dfn> compositing operator, the parts of the source which overlap the destination replace the destination. The destination is placed everywhere else.
941948

942949
<div class="figure">
943950
<img src="examples/PD_src-atop.svg" alt="example of porter duff source atop"/>
@@ -951,7 +958,7 @@ Source which overlaps the destination, replaces the destination. Destination is
951958

952959
<h4 id="porterduffcompositingoperators_dstatop">Destination Atop</h4>
953960

954-
Destination which overlaps the source replaces the source. Source is placed elsewhere.
961+
With the <dfn>destination-atop</dfn> compositing operator, the parts of the destination which overlaps the source replace the source. The source is placed everywhere else.
955962

956963
<div class="figure">
957964
<img src="examples/PD_dst-atop.svg" alt="example of porter duff destination atop"/>
@@ -965,7 +972,7 @@ Destination which overlaps the source replaces the source. Source is placed else
965972

966973
<h4 id="porterduffcompositingoperators_xor">XOR</h4>
967974

968-
The non-overlapping regions of source and destination are combined.
975+
With the <dfn>xor</dfn> compositing operator, the non-overlapping regions of source and destination are combined.
969976

970977
<div class="figure">
971978
<img src="examples/PD_xor.svg" alt="example of porter duff xor"/>
@@ -978,7 +985,7 @@ The non-overlapping regions of source and destination are combined.
978985
</pre>
979986

980987
<h4 id="porterduffcompositingoperators_plus">Lighter</h4>
981-
Display the sum of the source image and destination image. It is defined in the Porter Duff paper as the ''plus'' operator [[PORTERDUFF]].
988+
With the <dfn>lighter</dfn> compositing operator, the sum of the source image and destination image is displayed. It is defined in the Porter Duff paper as the ''plus'' operator [[PORTERDUFF]].
982989

983990
<pre>
984991
Fa = 1; Fb = 1
@@ -987,13 +994,18 @@ Display the sum of the source image and destination image. It is defined in the
987994
</pre>
988995

989996
<h4 id="porterduffcompositingoperators_plus_darker">Plus-darker</h4>
997+
998+
With the <dfn>plus-darker</dfn> compositing operator, the following steps are performed:
990999
<pre>
9911000
Fa = 1; Fb = 1
9921001
co = max(0, 1 - αs x Cs + 1 - αb x Cb);
9931002
αo = max(0, 1 - αs + 1 - αb);
9941003
</pre>
9951004

9961005
<h4 id="porterduffcompositingoperators_plus_lighter">Plus-lighter</h4>
1006+
1007+
With the <dfn>plus-lighter</dfn> compositing operator, the following steps are performed:
1008+
9971009
<pre>
9981010
Fa = 1; Fb = 1
9991011
co = min(1, αs x Cs + αb x Cb);
@@ -1003,18 +1015,15 @@ Display the sum of the source image and destination image. It is defined in the
10031015
<h3 id="groupcompositing">Group compositing behavior with Porter Duff modes</h3>
10041016
<!--<h4 id="groupcompositingisolation">Isolated groups and Porter Duff modes</h4>-->
10051017

1006-
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
1007-
which is dependent on the backdrop, such as <a href="#porterduffcompositingoperators_dst">destination</a>, <a href="#porterduffcompositingoperators_srcin">source-in</a>,
1008-
<a href="#porterduffcompositingoperators_dstin">destination-in</a>, <a href="#porterduffcompositingoperators_dstout">destination-out</a> or <a href="#porterduffcompositingoperators_srcatop">source-atop</a>,
1009-
then the result of the composite will be empty. Subsequent elements within the group are composited with the result of the first composite.
1018+
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 which is dependent on the backdrop, such as [=destination=], [=source-in=], [=destination-in=], [=destination-out=], or [=source-atop=], then the result of the composite will be empty. Subsequent elements within the group are composited with the result of the first composite.
10101019

10111020
<!--
10121021
<h4 id="groupcompositingknockout">Knockout groups and Porter Duff modes</h4>
10131022
<p>
10141023
Every element within a knock-out group is composited with the initial backdrop.
10151024
This means, that for every element within the group, the backdrop for the compositing of that element, is the initial backdrop.
10161025
</p><p>
1017-
In the example below, the elements within the group (the circle and the square) are composited using the <a href="#porterduffcompositingoperators_srcatop">source-atop</a> operator, with only the hexagon.
1026+
In the example below, the elements within the group (the circle and the square) are composited using the [=source-atop=] operator, with only the hexagon.
10181027
This has the effect of "knocking out" the circle, where it is overlapped by the square.<br>
10191028
Additionally, because the source-atop Porter Duff operator is used, the source shape (either the square or the circle) is only placed where the backdrop exists (the backdrop being the hexagon for both compositing operations within the group).
10201029
<div class="example"><img src="examples/pd-knockout.png" alt="example of knockout with porter duff"/></div>
@@ -1103,7 +1112,7 @@ now substitute the result of blending for Cs:
11031112
A blend mode is termed separable if each component of the result color is completely determined by the corresponding components of the constituent <a>backdrop</a> and source colors — that is, if the mixing formula is applied <strong>separately</strong> to each set of corresponding components.
11041113

11051114
Each of the following blend modes will apply the blending function B(Cb, Cs) on each of the color components.
1106-
For simplicity, all the examples in this chapter use <a href="#porterduffcompositingoperators_srcover">source-over</a> compositing.
1115+
For simplicity, all the examples in this chapter use [=source-over=] compositing.
11071116

11081117
<h4 id="blendingnormal"><dfn dfn-type="value" dfn-for="<blend-mode>">normal</dfn> blend mode</h4>
11091118

0 commit comments

Comments
 (0)