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.
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 ishlg
. 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 animg
element.