fabricjs / fabric.js

Javascript Canvas Library, SVG-to-Canvas (& canvas-to-SVG) Parser
http://fabricjs.com
Other
28.22k stars 3.45k forks source link

[Feature]: Add Display P3 color space #9465

Open mikhin opened 8 months ago

mikhin commented 8 months ago

CheckList

Description

Add Add Display P3 color space.

wider gamut color spaces have been defined for use in digital content, and which cover more of the colors that humans can perceive

Current State

Links:

Additional Context

No response

ShaMan123 commented 8 months ago

I am not sure what is supported or not. You can try to PR Seems that we should pass a config object to functions creating a Canvas2DRenderingContext. This way devs can control the color space and willReadFrequently. The same applies for toCanvasElement, toDataURL, toBlob A config option can also be added.

asturur commented 8 months ago

Do you have a link to the actual implemented proposal in w3c org?

mikhin commented 8 months ago

@asturur, there are couple links like these:

asturur commented 8 months ago

I would argue that for a feature like this a PR is not the best way to come up with. There are a bunch of issues that come to my mind:

Color class updates to handle the different formats Testing. How do we do testing for different color spaces functionalities? Node support. Does node-canvas have this ? ( no that i know of ). getContext changes: today we assume that the operation canvas.getContext('2d') give us back always the same context, while i m not sure what happens if you change the color space on the fly or if you can't specify the color space when getting a new context from somewhere else. Speed issues. When i tried it color space conversion had unbearable speed issue when doing the operations. Is that still the case? That wouldn't be a blocker since at the end a developer can configure the app as he/she prefers.

Definetely a larger plan needs to be done before try to pass a parameter in. If you want to start looking at those things feel free to do so, but take in mind this is possibly a medium/ long term project. Also if you can think of more color-space issues please add them in this thread