-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to reflect WhatWG changes #63
base: main
Are you sure you want to change the base?
Conversation
@@ -110,6 +103,8 @@ When an unsupported color space is requested, the color space will fall back to | |||
|
|||
### WebGL | |||
|
|||
_NOTE: This section is not finalized and is being fleshed out and reviewed in Khronos_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you like to link to KhronosGroup/WebGL#3285 ?
@@ -125,8 +120,12 @@ In implementations in which a ``UNPACK_COLORSPACE_CONVERSION_WEBGL`` of ``BROWSE | |||
|
|||
Note that, while convenient, this behavior is likely less efficient than specifying color conversion in ``ImageBitmapOptions``, where the color conversion may be done asynchronously and simultaneously with image decode. | |||
|
|||
An mechanism for using ``ImageBitmapOptions`` to specify color space conversion will be added in the context of WebGL color space support, to support asynchronous and decode-time color space conversion for texture data upload. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An mechanism -> A mechanism
WebGL's spec is managed outside of the W3C, so it's infeasible for it to make changes to the ImageBitmapOptions dictionary. Those changes will need to be made in the WHATWG spec.
### WebGPU | ||
|
||
_NOTE: This section is not finalized and is being fleshed out and reviewed in Khronos_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in Khronos - in the W3C. May want to link to https://github.com/gpuweb/gpuweb . I'm not sure there's a pull request open for this yet. cc @kainino0x @Kangz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's in progress. The section to link to is https://gpuweb.github.io/gpuweb/#color-spaces which links to the other relevant parts of the spec. There are some open github issues still, but everything is tracked inline in the spec.
For copying into WebGPU (done): https://gpuweb.github.io/gpuweb/#gpu-image-copy-texture-tagged
Importing (done except premultiplyAlpha): https://gpuweb.github.io/gpuweb/#external-texture-creation
Canvas output (not done, has issue): https://gpuweb.github.io/gpuweb/#presentation-configuration
@@ -151,26 +150,14 @@ Canvas contents are composited in accordance with the canvas element's style (e. | |||
The chromiumance of color values outside of [0, 1] is not to be clamped, and extended values may be used to display colors outside of the gamut defined by the canvas' color space's primaries. | |||
This is in contrast with luminance, which is to be clamped to the maximum standard dynamic range luminance, unless high dynamic range is explicitly enabled for the canvas element. | |||
|
|||
### ImageBitmap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per comment above, these changes can't be made in the WebGL or WebGPU specs; they need to be made in the WHATWG HTML spec. I think it's worth just leaving this here so that we know we have to make these changes in the WHATWG later.
### WebGPU | ||
|
||
_NOTE: This section is not finalized and is being fleshed out and reviewed in Khronos_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's in progress. The section to link to is https://gpuweb.github.io/gpuweb/#color-spaces which links to the other relevant parts of the spec. There are some open github issues still, but everything is tracked inline in the spec.
For copying into WebGPU (done): https://gpuweb.github.io/gpuweb/#gpu-image-copy-texture-tagged
Importing (done except premultiplyAlpha): https://gpuweb.github.io/gpuweb/#external-texture-creation
Canvas output (not done, has issue): https://gpuweb.github.io/gpuweb/#presentation-configuration
@@ -180,15 +167,14 @@ IDL: | |||
<pre> | |||
partial interface ImageData { | |||
constructor(unsigned long sw, unsigned long sh, optional ImageDataSettings); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing an argument name.
Also, it can default to {}
since that's effectively the default value. You could make the same change createImageData/getImageData too
constructor(unsigned long sw, unsigned long sh, optional ImageDataSettings); | |
constructor(unsigned long sw, unsigned long sh, optional ImageDataSettings settings = {}); |
constructor(ImageDataArray data, unsigned long sw, unsigned long sh, optional ImageDataSettings); | ||
readonly ImageDataSettings getImageDataSettings(); | ||
readonly attribute ImageDataArray data; | ||
constructor(Uint8ClampedArray data, unsigned long sw, unsigned long sh, optional ImageDataSettings); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constructor(Uint8ClampedArray data, unsigned long sw, unsigned long sh, optional ImageDataSettings); | |
constructor(Uint8ClampedArray data, unsigned long sw, unsigned long sh, optional ImageDataSettings settings = {}); |
### ImageData | ||
|
||
Add the following types to be used by `ImageData`. | ||
|
||
IDL: | ||
<pre> | ||
dictionary ImageDataSettings { | ||
PredefinedColorSpaceEnum colorSpace = "srgb"; | ||
PredefinedColorSpaceEnum colorSpace; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove "Enum"
* The constructors now take an optional `ImageDataSettings` dictionary. | ||
* The ImageDataSettings attribute may be queried using `getImageDataSettings`. | ||
The changes to this interface are that the constructors now take an optional `ImageDataSettings` dictionary. | ||
If this dictionary is specified and has a `colorSpace` entry, then the resulting `ImageData` will be created with the specified color space. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this dictionary is specified and has a `colorSpace` entry, then the resulting `ImageData` will be created with the specified color space. | |
If this dictionary is specified and has a `colorSpace` member, then the resulting `ImageData` will store pixel data in the specified color space. |
* The ImageDataSettings attribute may be queried using `getImageDataSettings`. | ||
The changes to this interface are that the constructors now take an optional `ImageDataSettings` dictionary. | ||
If this dictionary is specified and has a `colorSpace` entry, then the resulting `ImageData` will be created with the specified color space. | ||
If no dictionary is specified, or the specified dictionary does not specify a `colorSpace` entry, then the resulting `ImageData` will be created as ``"srgb"``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If no dictionary is specified, or the specified dictionary does not specify a `colorSpace` entry, then the resulting `ImageData` will be created as ``"srgb"``. | |
If no dictionary is specified, or the specified dictionary does not specify a `colorSpace` member, then the resulting `ImageData` will store pixel data in the ``"srgb"`` color space. |
* The ImageDataSettings attribute may be queried using `getImageDataSettings`. | ||
The changes to this interface are that the constructors now take an optional `ImageDataSettings` dictionary. | ||
If this dictionary is specified and has a `colorSpace` entry, then the resulting `ImageData` will be created with the specified color space. | ||
If no dictionary is specified, or the specified dictionary does not specify a `colorSpace` entry, then the resulting `ImageData` will be created as ``"srgb"``. | ||
|
||
When an ``ImageData`` is used in a canvas (e.g, in ``putImageData``), the data is converted from the ``ImageData``'s color space to the color space of the canvas. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be rephrased to indicate that the conversion can be in either direction (put vs. get)
The changes to this interface are the addion of the optional ``ImageDataSettings`` argument. If this argument is unspecified, then the default value of ``colorSpace="srgb"`` will be used (this default match previous behavior). | ||
The changes to this interface are the addition of the optional `ImageDataSettings` argument. | ||
If this dictionary is specified and has a `colorSpace` entry, then the resulting `ImageData` will be created with the specified color space. | ||
If no dictionary is specified, or the specified dictionary does not specify a `colorSpace` entry, then the resulting `ImageData` will default to using the same color space as the `CanvasRenderingContext2D` that the method is called on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If no dictionary is specified, or the specified dictionary does not specify a `colorSpace` entry, then the resulting `ImageData` will default to using the same color space as the `CanvasRenderingContext2D` that the method is called on. | |
If no dictionary is specified, or the specified dictionary does not specify a `colorSpace` member, then the resulting `ImageData` will default to using the same color space as the `CanvasRenderingContext2D` that the method is called on. |
In WhatWG review, a handful of changes were made to this proposal. Update to reflect these changes, to avoid confusion.