-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Adds wide-gamut support #3882
Adds wide-gamut support #3882
Conversation
Implementation bugs: Edge: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/18521261/ |
^gamut |
ops. :) thanks. |
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.
Great to see this happening! This will also fix an open issue (haven't looked for it yet).
I think this would be easier to review if you could split the pixelFormat and convertToBlob changes into separate PRs. Would that be too much of a hassle?
Is there a plan for tests?
source
Outdated
@@ -60069,6 +60082,15 @@ interface <dfn>Path2D</dfn> { | |||
|
|||
</dd> | |||
|
|||
<dt><var>context</var> = <var>canvas</var> . <code data-x="dom-canvas-getContext">getContext</code>('2d' [, { [ <code data-x="dom-CanvasRenderingContext2DSettings-pixelFormat">pixelFormat</code>: "float16" ] } ] )</dt> |
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 is a little weird if we don't also document the default.
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.
Ugh, this really is stressing the limits our domintro pseudo-language.
I would suggest rolling this into the previous dt/dd, as they are not mutually exclusive. My suggestion is either one of
context = canvas . getContext('2d' [, { [ alpha: false ] [, pixelFormat: "float16" ] } ] )
or give up on documenting all optionality/non-defaults and do
context = canvas . getContext('2d' [, { alpha, pixelFormat } ] )
Pinging @whatwg/canvas separately from OP as it doesn't work there due to bot reasons... |
Left |
Comments:
|
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 doesn't seem integrated into https://html.spec.whatwg.org/#offscreen-2d-context-creation-algorithm or https://html.spec.whatwg.org/#imagebitmaprenderingcontext-creation-algorithm . Is that intentional, or should those support pixelFormat too?
@@ -59318,6 +59318,17 @@ dictionary <dfn>AssignedNodesOptions</dfn> { | |||
<dd w-nodev> | |||
<pre><code class="idl" data-x="">typedef (<span>CanvasRenderingContext2D</span> or <span>ImageBitmapRenderingContext</span> or <span>WebGLRenderingContext</span>) <dfn>RenderingContext</dfn>; | |||
|
|||
enum <dfn>CanvasPixelFormat</dfn> { | |||
"8-8-8-8", // default | |||
"float16", |
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.
No trailing comma
source
Outdated
@@ -60069,6 +60082,15 @@ interface <dfn>Path2D</dfn> { | |||
|
|||
</dd> | |||
|
|||
<dt><var>context</var> = <var>canvas</var> . <code data-x="dom-canvas-getContext">getContext</code>('2d' [, { [ <code data-x="dom-CanvasRenderingContext2DSettings-pixelFormat">pixelFormat</code>: "float16" ] } ] )</dt> |
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.
Ugh, this really is stressing the limits our domintro pseudo-language.
I would suggest rolling this into the previous dt/dd, as they are not mutually exclusive. My suggestion is either one of
context = canvas . getContext('2d' [, { [ alpha: false ] [, pixelFormat: "float16" ] } ] )
or give up on documenting all optionality/non-defaults and do
context = canvas . getContext('2d' [, { alpha, pixelFormat } ] )
|
||
<dl> | ||
<dt><dfn><code data-x="dom-CanvasRenderingContext2DSettings-pixelFormat">pixelFormat</code></dfn></dt> | ||
<dd>Decides the backing storage for the <code data-x="dom-context-2d-canvas">canvas</code>'s |
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 is a description, but doesn't make any statements requiring the user agent to do anything. Some questions:
- What does this impact, observably? Does it change the numeric values returned from any canvas or pixel-reading APIs?
- Is "backing storage" the same as the CanvasRenderingContext2D's output bitmap?
- What does "optional" mean? Does it mean fall back to 8-8-8, or throw an exception, or...?
- Where is this information stored? What parts of the spec later use it?
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.
@@ -59318,6 +59318,17 @@ dictionary <dfn>AssignedNodesOptions</dfn> { | |||
<dd w-nodev> | |||
<pre><code class="idl" data-x="">typedef (<span>CanvasRenderingContext2D</span> or <span>ImageBitmapRenderingContext</span> or <span>WebGLRenderingContext</span>) <dfn>RenderingContext</dfn>; | |||
|
|||
enum <dfn>CanvasPixelFormat</dfn> { | |||
"8-8-8-8", // default |
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.
I presume you're using this pattern (which looks kinda odd to me, and doesn't match the structure of the other option) instead of something like int8
because we want to be open to things like 10-10-10-2
or whatever in the future?
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.
exactly.
There's an Intent to Ship: Canvas Color Management on blink-dev now, pointing back to this PR and #3926. @annevk @domenic, do either of you have the bandwidth to keep reviewing this? @fserb, I see the "needs tests" label, do the tests in https://wpt.fyi/results/2dcontext/wide-gamut-canvas fully cover the changes in this PR, or are more needed? |
Documentation need recorded on https://trello.com/c/N0hJJV95/129-2d-canvas-api |
The Chrome intent to ship says
but I couldn't find the tests. A link would be helpful. I'm mainly wanting to read the tests as worked examples to help my review of the spec. |
<dd>Decides the backing storage for the <code data-x="dom-context-2d-canvas">canvas</code>'s | ||
context. Support for "8-8-8-8" is mandatory. All other formats are optional. When using "8-8-8-8", | ||
one byte is used for each color channel and 1 byte used for alpha. When using float | ||
formats, values outside of [0, 1] range can be used to represent colors outside of the color |
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 requires the transfer function to be fully specified outside [0,1].
Could I have a pointer to where that is defined?
@fserb @zakerinasab, can you point to the existing tests in WPT? Presumably they need to be updated at least a little for this change? |
@foolip: this is tests we have so far: |
@svgeesus, hope that helps! |
@fserb perhaps the questions from @domenic were missed? |
Someone(s) with time would need to define the underlying model and processing model on top, as well as write the relevant tests. We have an API sketch, but none of the remainder, from a quick look and from what I remember when we last went through this. |
#6562 lays some groundwork for this. Closing this as it's outdated and needs a lot more work as per the above comments. |
This is pulling a part of: https://github.com/WICG/canvas-color-space/blob/master/CanvasColorSpaceProposal.md into the spec.
This includes Context 2D creation params and adding a new
convertToBlob
function tocanvas
andoffscreenCanvas
.@domenic @whatwg/canvas
💥 Error: Wattsi server error 💥
PR Preview failed to build. (Last tried on Jan 15, 2021, 7:58 AM UTC).
More
PR Preview relies on a number of web services to run. There seems to be an issue with the following one:
🚨 Wattsi Server - Wattsi Server is the web service used to build the WHATWG HTML spec.
🔗 Related URL
If you don't have enough information above to solve the error by yourself (or to understand to which web service the error is related to, if any), please file an issue.