diff --git a/source b/source index 904af003371..aca1fca2637 100644 --- a/source +++ b/source @@ -2845,6 +2845,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
DOMString
double
Float16Array
Function
long
object
imageData = new ImageData(data, sw [, sh [, settings ] ])
Returns an ImageData
object using the data provided in the Uint8ClampedArray
argument, interpreted using the given
- dimensions and the color space indicated by settings.
Returns an ImageData
object using the data provided in the ImageDataArray
+ argument, interpreted using the given dimensions and the color space indicated by settings.
As each pixel in the data is represented by four numbers, the length of the data needs to be - a multiple of four times the given width. If the height is provided as well, then the length - needs to be exactly the width times the height times 4.
+The byte length of the data needs to be a multiple of the number of bytes per pixel times the + given width. If the height is provided as well, then the length needs to be exactly the number of + bytes per pixel times the width times the height.
Throws an "IndexSizeError
" DOMException
if the given
data and dimensions can't be interpreted consistently, or if either dimension is zero.
IndexSizeError
" DOMException
.
Initialize this given - sw, sh, and settings set to settings.
Initialize the image data of this to transparent black.
Let length be the number of bytes in data.
Let bytesPerPixel be 4 if
+ settings["pixelFormat
"] is
+ "rgba-unorm8"; otherwise 8.
Let length be the buffer source byte length of data.
If length is not a nonzero integral multiple of four, then throw an +
If length is not a nonzero integral multiple of bytesPerPixel, then throw an
"InvalidStateError
" DOMException
.
Let length be length divided by four.
+Let length be length divided by bytesPerPixel.
If length is not an integral multiple of sw, then throw an @@ -70514,13 +70524,11 @@ try {
Initialize this given - sw, sh, settings set to settings, and + sw, sh, settings, and source set to data.
This step does not set this's data to a copy of data.
- It sets it to the actual Uint8ClampedArray
object
- passed as data.
ImageDataArray
object passed as data.
Let newImageData be a new ImageData
object.
Initialize newImageData - given the absolute magnitude of sw, the absolute magnitude of sh, settings set to settings, and - defaultColorSpace set to - this's color space.
Initialize the image data of newImageData to transparent black.
Let newImageData be a new ImageData
object.
Let settings be the ImageDataSettings
object «[
+ "colorSpace
" →
+ this's colorSpace,
+ "pixelFormat
" →
+ this's pixelFormat ]».
Initialize newImageData
given the value of imageData's width
attribute, the value of imageData's height
- attribute, and defaultColorSpace set to the value of
- imageData's colorSpace
attribute.
Initialize the image data of newImageData to transparent black.
Let imageData be a new ImageData
object.
Initialize imageData given - sw, sh, settings set to settings, and + sw, sh, settings, and defaultColorSpace set to this's color space.
To initialize an ImageData
object imageData, given a
- positive integer number of rows rows, a positive integer number of pixels per row
- pixelsPerRow, an optional ImageDataSettings
settings, an optional Uint8ClampedArray
source, and an optional
- PredefinedColorSpace
pixelsPerRow, a positive integer number
+ of rows rows, an ImageDataSettings
settings, an optional
+ ImageDataArray
source,
+ and an optional PredefinedColorSpace
defaultColorSpace:
If source was given, then initialize the data
attribute of imageData to
- source.
If source was given:
+ +If settings["pixelFormat
"]
+ equals "rgba-unorm8" and
+ source is not a Uint8ClampedArray
,
+ then throw an "InvalidStateError
" DOMException
.
If settings["pixelFormat
"]
+ is "rgba-float16" and
+ source is not a Float16Array
,
+ then throw an "InvalidStateError
" DOMException
.
Initialize the data
attribute of imageData to
+ source.
Otherwise (source was not given), initialize the data
attribute of imageData to a new Uint8ClampedArray
object. The Uint8ClampedArray
object must use a new Canvas
- Pixel ArrayBuffer
for its storage, and must have a
- zero start offset and a length equal to the length of its storage, in bytes. The Canvas
- Pixel ArrayBuffer
must have the correct size to
- store rows × pixelsPerRow pixels.
Otherwise (source was not given):
+ +If settings["pixelFormat
"] is "rgba-unorm8", then initialize the data
attribute of imageData to a new Uint8ClampedArray
object. The Uint8ClampedArray
object must use a new
+ ArrayBuffer
for its storage, and must have
+ a zero byte offset and byte length equal to the length of its storage, in bytes.
+ The storage ArrayBuffer
must have a length
+ of 4 × rows × pixelsPerRow bytes.
Otherwise, if settings["pixelFormat
"] is "rgba-float16", then initialize the data
attribute of imageData to a new Float16Array
object. The Float16Array
object must use a new
+ ArrayBuffer
for its storage, and must have
+ a zero byte offset and byte length equal to the length of its storage, in bytes.
+ The storage ArrayBuffer
must have a length
+ of 8 × rows × pixelsPerRow bytes.
If the Canvas Pixel ArrayBuffer
cannot be
- allocated, then rethrow the RangeError
thrown by JavaScript,
- and return.
If the storage ArrayBuffer
could not be
+ allocated, then rethrow the RangeError
thrown by JavaScript,
+ and return.
Initialize the height
attribute of imageData to
rows.
If settings was given and settings[" Initialize the
+ colorSpace
"] exists, then initialize the pixelFormat
+ attribute of imageData to
+ settings["pixelFormat
"].
If settings["colorSpace
"]
+ exists, then initialize the colorSpace
attribute of imageData to
settings["colorSpace
"].
Otherwise, if defaultColorSpace was given, then initialize the colorSpace
attribute of imageData to
- defaultColorSpace.
Otherwise, initialize the colorSpace
attribute of imageData to "srgb".
Set serialized.[[ColorSpace]] to the value of value's colorSpace
attribute.
Set serialized.[[PixelFormat]] to the value of value's pixelFormat
attribute.
Their deserialization steps, given serialized, value, @@ -70691,15 +70737,38 @@ try {
Initialize value's colorSpace
attribute to serialized.[[ColorSpace]].
A Canvas Pixel ArrayBuffer
is an ArrayBuffer
whose data is represented in left-to-right order, row
- by row top to bottom, starting with the top left, with each pixel's red, green, blue, and alpha
- components being given in that order for each pixel. Each component of each pixel represented in
- this array must be in the range 0..255, representing the 8 bit value for that component. The
- components must be assigned consecutive indices starting with 0 for the top left pixel's red
- component.
Initialize value's pixelFormat
+ attribute to serialized.[[PixelFormat]].
The ImageDataPixelFormat
enumeration is used to specify type of the
+ data
attribute of an ImageData
+ and the arrangement and numerical representation of the color components for each pixel.
The "rgba-unorm8
" value indicates that the
+ data
attribute of an ImageData
must be of
+ type Uint8ClampedArray. The color components of each
+ pixel must be stored in four sequential elements in the order of red, green, blue, and then alpha.
+ Each element represents the 8-bit unsigned normalized value for that component.
The "rgba-float16
" value indicates that the
+ data
attribute of an ImageData
must be of
+ type Float16Array. The color components of each pixel must
+ be stored in four sequential elements in the order of red, green, blue, and then alpha. Each
+ element represents the value for that component.
An ImageData
object
+ represents a rectanglar bitmap with width equal to the
+ width
attribute and height equal to the height
+ attribute. The pixel values of this bitmap are stored in the
+ data
attribute in left-to-right order, row by row from top to bottom, starting with 0 for
+ the top left pixel, with the order and numerical representation of the color components of each
+ pixel determined by the pixelFormat
attribute.
+ The color space of the pixel values of the bitmap is determined by the colorSpace
attribute.
The putImageData(imageData,
@@ -70777,7 +70846,7 @@ try {
set the pixel with coordinate (dx+x,
dy+y) in bitmap to the color of the pixel at coordinate
(x, y) in the imageData data structure's
- Canvas Pixel
ArrayBuffer
,
+ bitmap,
converted from imageData's colorSpace
to the color space of bitmap
using 'relative-colorimetric' rendering intent.