w3c / ColorWeb-CG

repo for the Color on the Web Community Group
54 stars 21 forks source link

Allow "display" mode to be independent of color space #64

Open ccameron-chromium opened 3 years ago

ccameron-chromium commented 3 years ago

Suppose an application wishes to operate in a linear space, but would prefer that their output be composited as HLG or as PQ.

The following code could be one way of accomplishing this. The specifies that the canvas' storage (and thus working space) is extended-linear-srgb, but that its HDR compositing mode is hlg. The way that this is composited would be equivalent to converting to HLG before applying tonemapping. It would also have the property that any HLG images that are drawn to the canvas will appear exactly as they would, had they been specified in an img element.

    canvas.configureHighDynamicRange({mode:'rec2100-hlg'});
    context = canvas.getContext('2d', {colorSpace:'extended-linear-srgb'})