Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Move ImageData interface documentation out of CanvasImageData (and cleanup) #11163

@ccameron-chromium

Description

@ccameron-chromium

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    editorialChanges that do not affect how the standard is understoodtopic: canvas

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions