@@ -2907,6 +2907,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
2907
2907
<li><dfn data-x="idl-DOMString" data-x-href="https://webidl.spec.whatwg.org/#idl-DOMString"><code>DOMString</code></dfn></li>
2908
2908
<li><dfn data-x="idl-double" data-x-href="https://webidl.spec.whatwg.org/#idl-double"><code>double</code></dfn></li>
2909
2909
<li><dfn data-x="IDL enumeration" data-x-href="https://webidl.spec.whatwg.org/#idl-enums">enumeration</dfn></li>
2910
+ <li><dfn data-x="idl-Float16Array" data-x-href="https://webidl.spec.whatwg.org/#idl-Float16Array"><code>Float16Array</code></dfn></li>
2910
2911
<li><dfn data-x="idl-Function" data-x-href="https://webidl.spec.whatwg.org/#common-Function"><code>Function</code></dfn></li>
2911
2912
<li><dfn data-x="idl-long" data-x-href="https://webidl.spec.whatwg.org/#idl-long"><code>long</code></dfn></li>
2912
2913
<li><dfn data-x="idl-object" data-x-href="https://webidl.spec.whatwg.org/#idl-object"><code>object</code></dfn></li>
@@ -66035,19 +66036,25 @@ interface <dfn interface>TextMetrics</dfn> {
66035
66036
readonly attribute double <span data-x="dom-textmetrics-ideographicBaseline">ideographicBaseline</span>;
66036
66037
};
66037
66038
66039
+ typedef (<span data-x="idl-Uint8ClampedArray">Uint8ClampedArray</span> or <span data-x="idl-Float16Array">Float16Array</span>) <dfn typedef>ImageDataArray</dfn>;
66040
+
66041
+ enum <dfn enum>ImageDataPixelFormat</dfn> { "<span data-x="dom-ImageDataPixelFormat-rgba-unorm8">rgba-unorm8</span>", "<span data-x="dom-ImageDataPixelFormat-rgba-float16">rgba-float16</span>" };
66042
+
66038
66043
dictionary <dfn dictionary>ImageDataSettings</dfn> {
66039
66044
<span>PredefinedColorSpace</span> <span data-x="dom-PredefinedColorSpace-srgb">colorSpace</span>;
66045
+ <span>ImageDataPixelFormat</span> <span data-x="dom-ImageDataSettings-pixelFormat">pixelFormat</span> = "<span data-x="dom-ImageDataPixelFormat-rgba-unorm8">rgba-unorm8</span>";
66040
66046
};
66041
66047
66042
66048
[Exposed=(Window,Worker),
66043
66049
<span>Serializable</span>]
66044
66050
interface <dfn interface>ImageData</dfn> {
66045
66051
<span data-x="dom-imagedata">constructor</span>(unsigned long sw, unsigned long sh, optional <span>ImageDataSettings</span> settings = {});
66046
- <span data-x="dom-imagedata-with-data">constructor</span>(<span data-x="idl-Uint8ClampedArray">Uint8ClampedArray </span> data, unsigned long sw, optional unsigned long sh, optional <span>ImageDataSettings</span> settings = {});
66052
+ <span data-x="dom-imagedata-with-data">constructor</span>(<span>ImageDataArray </span> data, unsigned long sw, optional unsigned long sh, optional <span>ImageDataSettings</span> settings = {});
66047
66053
66048
66054
readonly attribute unsigned long <span data-x="dom-imagedata-width">width</span>;
66049
66055
readonly attribute unsigned long <span data-x="dom-imagedata-height">height</span>;
66050
- readonly attribute <span data-x="idl-Uint8ClampedArray">Uint8ClampedArray</span> <span data-x="dom-imagedata-data">data</span>;
66056
+ readonly attribute <span>ImageDataArray</span> <span data-x="dom-imagedata-data">data</span>;
66057
+ readonly attribute <span>ImageDataPixelFormat</span> <span data-x="dom-imagedata-pixelFormat">pixelFormat</span>;
66051
66058
readonly attribute <span>PredefinedColorSpace</span> <span data-x="dom-imagedata-colorSpace">colorSpace</span>;
66052
66059
};
66053
66060
@@ -70400,9 +70407,8 @@ try {
70400
70407
70401
70408
<dt><code data-x=""><var>imageData</var> = new <span subdfn data-x="dom-imagedata-with-data">ImageData</span>(<var>data</var>, <var>sw</var> [, <var>sh</var> [, <var>settings</var> ] ])</code></dt>
70402
70409
<dd>
70403
- <p>Returns an <code>ImageData</code> object using the data provided in the <code
70404
- data-x="idl-Uint8ClampedArray">Uint8ClampedArray</code> argument, interpreted using the given
70405
- dimensions and the color space indicated by <var>settings</var>.</p>
70410
+ <p>Returns an <code>ImageData</code> object using the data provided in the <code>ImageDataArray</code>
70411
+ argument, interpreted using the given dimensions and the color space indicated by <var>settings</var>.</p>
70406
70412
70407
70413
<p>As each pixel in the data is represented by four numbers, the length of the data needs to be
70408
70414
a multiple of four times the given width. If the height is provided as well, then the length
@@ -70491,7 +70497,7 @@ try {
70491
70497
constructor steps are:</p>
70492
70498
70493
70499
<ol>
70494
- <li><p>Let <var>length</var> be the number of bytes in <var>data</var>.</p></li>
70500
+ <li><p>Let <var>length</var> be the length of <var>data</var>.</p></li>
70495
70501
70496
70502
<li><p>If <var>length</var> is not a nonzero integral multiple of four, then throw an
70497
70503
<span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.</p></li>
@@ -70519,8 +70525,7 @@ try {
70519
70525
<i><span data-x="initialize-imagedata-source">source</span></i> set to <var>data</var>.</p>
70520
70526
70521
70527
<p class="note">This step does not set <span>this</span>'s data to a copy of <var>data</var>.
70522
- It sets it to the actual <code data-x="idl-Uint8ClampedArray">Uint8ClampedArray</code> object
70523
- passed as <var>data</var>.</p>
70528
+ It sets it to the actual <code>ImageData</code> object passed as <var>data</var>.</p>
70524
70529
</li>
70525
70530
</ol>
70526
70531
@@ -70609,30 +70614,61 @@ try {
70609
70614
<p>To <dfn>initialize an <code>ImageData</code> object</dfn> <var>imageData</var>, given a
70610
70615
positive integer number of rows <var>rows</var>, a positive integer number of pixels per row
70611
70616
<var>pixelsPerRow</var>, an optional <code>ImageDataSettings</code> <dfn
70612
- data-x="initialize-imagedata-settings"><var>settings</var></dfn>, an optional <code
70613
- data-x="idl-Uint8ClampedArray">Uint8ClampedArray</code> <dfn
70614
- data-x="initialize-imagedata-source"><var>source</var></dfn>, and an optional
70615
- <code>PredefinedColorSpace</code> <dfn
70617
+ data-x="initialize-imagedata-settings"><var>settings</var></dfn>, an optional
70618
+ <code>ImageDataArray</code> <dfn data-x="initialize-imagedata-source"><var>source</var></dfn>,
70619
+ and an optional <code>PredefinedColorSpace</code> <dfn
70616
70620
data-x="initialize-imagedata-defaultcolorspace"><var>defaultColorSpace</var></dfn>:</p>
70617
70621
70618
70622
<ol>
70619
- <li><p>If <var>source</var> was given, then initialize the <dfn attribute for="ImageData"><code
70620
- data-x="dom-imagedata-data">data</code></dfn> attribute of <var>imageData</var> to
70621
- <var>source</var>.</p></li>
70623
+ <li><p>If <var>source</var> was given then:</p>
70624
+ <ol>
70625
+ <li><p>If <var>settings</var> was given and
70626
+ <var>settings</var>["<code data-x="dom-ImageDataSettings-pixelFormat">pixelFormat</code>"]
70627
+ equals "<span data-x="dom-ImageDataPixelFormat-rgba-unorm8">rgba-unorm8</span>" and
70628
+ <var>source</var> is not of type <code data-x="idl-Uint8ClampedArray">Uint8ClampedArray</code>
70629
+ then throw an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.</p></li>
70622
70630
70623
- <li>
70624
- <p>Otherwise (<var>source</var> was not given), initialize the <code
70625
- data-x="dom-imagedata-data">data</code> attribute of <var>imageData</var> to a new <code
70626
- data-x="idl-Uint8ClampedArray">Uint8ClampedArray</code> object. The <code
70627
- data-x="idl-Uint8ClampedArray">Uint8ClampedArray</code> object must use a new <span>Canvas
70628
- Pixel <code data-x="idl-ArrayBuffer">ArrayBuffer</code></span> for its storage, and must have a
70629
- zero start offset and a length equal to the length of its storage, in bytes. The <span>Canvas
70630
- Pixel <code data-x="idl-ArrayBuffer">ArrayBuffer</code></span> must have the correct size to
70631
- store <var>rows</var> × <var>pixelsPerRow</var> pixels.</p>
70631
+ <li><p>If <var>settings</var> was given and
70632
+ <var>settings</var>["<code data-x="dom-ImageDataSettings-pixelFormat">pixelFormat</code>"]
70633
+ equals "<span data-x="dom-ImageDataPixelFormat-rgba-float16">rgba-float16</span>" and
70634
+ <var>source</var> is not of type <code data-x="idl-Float16Array">Float16Array</code>
70635
+ then throw an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.</p></li>
70632
70636
70633
- <p>If the <span>Canvas Pixel <code data-x="idl-ArrayBuffer">ArrayBuffer</code></span> cannot be
70634
- allocated, then rethrow the <code data-x="js-RangeError">RangeError</code> thrown by JavaScript,
70635
- and return.</p>
70637
+ <li><p>Initialize the <dfn attribute for="ImageData"><code
70638
+ data-x="dom-imagedata-data">data</code></dfn> attribute of <var>imageData</var> to
70639
+ <var>source</var>.</p></li>
70640
+ </ol>
70641
+ </li>
70642
+
70643
+ <li><p>Otherwise (<var>source</var> was not given):</p>
70644
+ <ol>
70645
+ <li><p>If <var>settings</var> was given and
70646
+ <var>settings</var>["<code data-x="dom-ImageDataSettings-pixelFormat">pixelFormat</code>"]
70647
+ equals "<span data-x="dom-ImageDataPixelFormat-rgba-unorm8">rgba-unorm8</span>", or if
70648
+ <var>settings</var> was not given, then
70649
+ initialize the <code data-x="dom-imagedata-data">data</code> attribute of <var>imageData</var> to a new
70650
+ <code data-x="idl-Uint8ClampedArray">Uint8ClampedArray</code> object.
70651
+ The <code data-x="idl-Uint8ClampedArray">Uint8ClampedArray</code> object
70652
+ must have a length of 4 × <var>rows</var> × <var>pixelsPerRow</var> elements,
70653
+ must use a new <code data-x="idl-ArrayBuffer">ArrayBuffer</code> for its storage,
70654
+ must have a byte offset of zero bytes,
70655
+ and must have a byte length of 4 × <var>rows</var> × <var>pixelsPerRow</var> bytes.
70656
+ If the <code data-x="idl-ArrayBuffer">ArrayBuffer</code> could not be allocated, then rethrow the
70657
+ <code data-x="js-RangeError">RangeError</code> thrown by JavaScript, and return.</p></li>
70658
+
70659
+ <li><p>If <var>settings</var> was given and
70660
+ <var>settings</var>["<code data-x="dom-ImageDataSettings-pixelFormat">pixelFormat</code>"]
70661
+ equals "<span data-x="dom-ImageDataPixelFormat-rgba-float16">rgba-float16</span>", then
70662
+ initialize the <code data-x="dom-imagedata-data">data</code> attribute of <var>imageData</var> to a new
70663
+ <code data-x="idl-Float16Array">Float16Array</code> object.
70664
+ The <code data-x="idl-Float16Array">Float16Array</code> object
70665
+ must have a length of 4 × <var>rows</var> × <var>pixelsPerRow</var> elements,
70666
+ must use a new <code data-x="idl-ArrayBuffer">ArrayBuffer</code> for its storage,
70667
+ must have a byte offset of zero bytes,
70668
+ and must have a byte length of 8 × <var>rows</var> × <var>pixelsPerRow</var> bytes.
70669
+ If the <code data-x="idl-ArrayBuffer">ArrayBuffer</code> could not be allocated, then rethrow the
70670
+ <code data-x="js-RangeError">RangeError</code> thrown by JavaScript, and return.</p></li>
70671
+ </ol>
70636
70672
</li>
70637
70673
70638
70674
<li><p>Initialize the <dfn attribute for="ImageData"><code
@@ -70643,6 +70679,16 @@ try {
70643
70679
data-x="dom-imagedata-height">height</code></dfn> attribute of <var>imageData</var> to
70644
70680
<var>rows</var>.</p></li>
70645
70681
70682
+ <li><p>If <var>settings</var> was given, then initialize the
70683
+ <dfn attribute for="ImageData"><code data-x="dom-imagedata-pixelFormat">pixelFormat</code></dfn>
70684
+ attribute of <var>imageData</var> to
70685
+ <var>settings</var>["<dfn dict-member for="ImageDataSettings"><code
70686
+ data-x="dom-ImageDataSettings-pixelFormat">pixelFormat</code></dfn>"].</p></li>
70687
+
70688
+ <li><p>Otherwise, initialize the <code data-x="dom-imagedata-pixelFormat">pixelFormat</code>
70689
+ attribute of <var>imageData</var> to
70690
+ "<span data-x="dom-ImageDataPixelFormat-rgba-unorm8">rgba-unorm8</span>".</p></li>
70691
+
70646
70692
<li><p>If <var>settings</var> was given and <var>settings</var>["<code
70647
70693
data-x="dom-ImageDataSettings-colorSpace">colorSpace</code>"] <span data-x="map
70648
70694
exists">exists</span>, then initialize the <dfn attribute for="ImageData"><code
@@ -70693,13 +70739,33 @@ try {
70693
70739
attribute to <var>serialized</var>.[[ColorSpace]].</p></li>
70694
70740
</ol>
70695
70741
70696
- <p>A <dfn>Canvas Pixel <code data-x="idl-ArrayBuffer">ArrayBuffer</code></dfn> is an <code
70697
- data-x="idl-ArrayBuffer">ArrayBuffer</code> whose data is represented in left-to-right order, row
70698
- by row top to bottom, starting with the top left, with each pixel's red, green, blue, and alpha
70699
- components being given in that order for each pixel. Each component of each pixel represented in
70700
- this array must be in the range 0..255, representing the 8 bit value for that component. The
70701
- components must be assigned consecutive indices starting with 0 for the top left pixel's red
70702
- component.</p>
70742
+ <p>The <code>ImageDataPixelFormat</code> enumeration is used to specify type of the
70743
+ <code data-x="dom-imagedata-data">data</code> attribute of an <code>ImageData</code>
70744
+ and the arrangement and numerical representation of the color channel values for each pixel.</p>
70745
+
70746
+ <p>The "<dfn enum-value for="ImageDataPixelFormat"><code
70747
+ data-x="dom-ImageDataPixelFormat-rgba-unorm8">rgba-unorm8</code></dfn>" value indicates that the
70748
+ <code data-x="dom-imagedata-data">data</code> attribute of an <code>ImageData</code> must be of type
70749
+ <span data-x="idl-Uint8ClampedArray">Uint8ClampedArray</span>.
70750
+ The color components of each pixel must be stored in four sequential elements in the order of red, green, blue, and then alpha.
70751
+ Each element represents the 8-bit unsigned normalized value for that component.</p>
70752
+
70753
+ <p>The "<dfn enum-value for="ImageDataPixelFormat"><code
70754
+ data-x="dom-ImageDataPixelFormat-rgba-float16">rgba-float16</code></dfn>" value indicates that the
70755
+ <code data-x="dom-imagedata-data">data</code> attribute of an <code>ImageData</code> must be of type
70756
+ <span data-x="idl-Float16Array">Float16Array</span>.
70757
+ The color components of each pixel must be stored in four sequential elements in the order of red, green, blue, and then alpha.
70758
+ Each element represents the value for that component.</p>
70759
+
70760
+ <p>An <code>ImageData</code> object <dfn data-x="concept-imagedata-bitmap-representation">represents a rectanglar bitmap</dfn>
70761
+ with width equal to the <code data-x="dom-imagedata-width">width</code> attribute
70762
+ and height equal to the <code data-x="dom-imagedata-height">height</code> attribute.
70763
+ The pixel values of this bitmap are stored in the <code data-x="dom-imagedata-data">data</code> attribute
70764
+ in left-to-right order, row by row from top to bottom, starting with 0 for the top left pixel,
70765
+ with the order and numerical representation of the color components of each
70766
+ pixel determined by the <code data-x="dom-imagedata-pixelFormat">pixelFormat</code> attribute.
70767
+ The color space of the pixel values of the bitmap is determined by the
70768
+ <code data-x="dom-imagedata-colorSpace">colorSpace</code> attribute.</p>
70703
70769
70704
70770
<p>The <dfn method for="CanvasImageData"><code
70705
70771
data-x="dom-context-2d-putImageData-short">putImageData(<var>imageData</var>,
@@ -70777,7 +70843,7 @@ try {
70777
70843
set the pixel with coordinate (<span data-x=""><var>dx</var>+<var>x</var></span>,
70778
70844
<var>dy</var>+<var>y</var>) in <var>bitmap</var> to the color of the pixel at coordinate
70779
70845
(<var>x</var>, <var>y</var>) in the <var>imageData</var> data structure's
70780
- <span>Canvas Pixel <code data-x="idl-ArrayBuffer">ArrayBuffer</code> </span>,
70846
+ <span data-x="concept-imagedata-bitmap-representation">bitmap </span>,
70781
70847
converted from <var>imageData</var>'s <code data-x="dom-imagedata-colorSpace">colorSpace</code>
70782
70848
to the <span data-x="concept-canvas-color-space">color space</span> of <var>bitmap</var>
70783
70849
using <span>'relative-colorimetric'</span> rendering intent.</p></li>
0 commit comments