Proposal document: https://github.com/WICG/canvas-color-space/blob/main/CanvasColorSpaceProposal.md Syntax for creating such a canvas is var context = canvas.getContext('2d', {colorSpace:'display-p3'}); Similar syntax for use with ImageData. Corresponding bugs: Chromium: crbug.com/1083693 Mozilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1703654
Created attachment 427308 [details] basic test case
Created attachment 427309 [details] Proof of concept patch that gets things working
Created attachment 427479 [details] Now with ImageData support
Very excited to see this! There are a couple of things that changed from the proposal to what was agreed upon in the WhatWG PR. To draw your attention to them: * The PredefinedColorSpace interface to query for valid PredefinedColorSpaceEnum values is gone. There's just PredefinedColorSpace as an enum (with "srgb" and "display-p3" as options). * For ImageDataSettings, the PredefinedColorSpace is optional. The canvas methods getImageData and createImageData will use the color space of the canvas if colorSpace was not specified in ImageDataSettings. * The ImageBitmap part was taken out (ImageBitmapOptions will change to have an optional PredefinedColorSpace, rather than a required one, so that the ImageBitmap will default internally to "whatever is the best internal color space") I think that's it. We're working on upstreaming WPT tests for all of this. Feel free to reach out.
(In reply to Christopher Cameron from comment #4) > Very excited to see this! > > There are a couple of things that changed from the proposal to what was > agreed upon in the WhatWG PR. To draw your attention to them: Great. Thanks for letting me know and continuing to drive this. Is that PR up for review anywhere?
(In reply to Sam Weinig from comment #5) > (In reply to Christopher Cameron from comment #4) > > Very excited to see this! > > > > There are a couple of things that changed from the proposal to what was > > agreed upon in the WhatWG PR. To draw your attention to them: > > Great. Thanks for letting me know and continuing to drive this. > > Is that PR up for review anywhere? Found it. Better yet, it is now in main! https://github.com/whatwg/html/commit/85cb202a052c462bd6830b3dda96e7edbd1dcd75
Tracking initial support (no ImageData) in https://bugs.webkit.org/show_bug.cgi?id=225286.
<rdar://problem/77542907>
ImageData support now being worked on in https://bugs.webkit.org/show_bug.cgi?id=225841.
Additional things to do after ImageData: - Ensure it works and add tests for drawing non-sRGB CanvasImageSources (image, videos, other canvases) into canvas (including patterns). - Ensure it works and add tests for drawing non-sRGB gradients. - Ensure it works and add tests for drawing non-sRGB shadows.
We can consider this done.
*** Bug 188320 has been marked as a duplicate of this bug. ***