-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
What is the issue with the HTML Standard?
The HTML specification currently specifies the ImageData
interface as a sort of "afterthought" inside the CanvasImageData
interface specification.
E.g, here, at the very beginning of the normative text for the Pixel Manipulation section, we read
Objects that implement the
CanvasImageData
interface provide the following methods for reading and writing pixel data to the bitmap.
The
new ImageData(sw, sh, settings)
constructor steps are: [...]
This doesn't make much sense. The ImageData
constructor isn't a method on CanvasImageData
, or related to it at all.
What's missing is a separate "ImageData
objects" section. The lowest-friction change here would be to add this section just before the "Pixel manipulation" subsection of the "The 2D rendering context" section. That said, because ImageData
is quite is own independent thing (it's used by WebGL and WebGPU), it may be that it should be pulled out of the canvas section entirely.
In addition to the "the reorganized thing would make more sense" benefit, this would allow us to clean up the way that ImageData
is written. In particular, this review comment observed that ImageData
is initializing attributes (for all attributes), rather than defining internal fields and getters.