tiny-skia icon indicating copy to clipboard operation
tiny-skia copied to clipboard

Add linear color space support

Open RazrFalcon opened this issue 5 years ago • 8 comments
trafficstars

RazrFalcon avatar Nov 07 '20 21:11 RazrFalcon

It would be great if this included support for out-of-gamut color values. I.e. values > 1.0 (HDR) and < 0.0 (for certain blending effects). At least for the cases where all data is f32 or f16 this merely is avoiding any clamping anywhere in the pipeline (could be hidden behind a hdr feature gate).

virtualritz avatar Dec 14 '20 22:12 virtualritz

Does this supported by Skia? Because tiny-skia is and will be just a Skia fork.

RazrFalcon avatar Dec 14 '20 22:12 RazrFalcon

It is not only supported, it's the default behavior. I just tried via safe-skia. f32 channel Pixmap written out as an OpenEXR and using out-of-gamut Color4fs on a gradient. All values are ending up in the EXR unclamped.

I can send you can example, if you like.

virtualritz avatar Dec 15 '20 00:12 virtualritz

This would be great, because I'm not sure about what feature are you talking. And Color in tiny-skia (aka Color4f) is always clamped.

RazrFalcon avatar Dec 15 '20 10:12 RazrFalcon

Check out my port of the icon example from skia-safe. Modified to use linear color and writing out an OpenEXR of a single image to check in a third party app. I attached a screenshot from 3Delight Display which has a sampler tool. You can see the value from the code below (R10.0, G5.0, B2.0, A1.0) is retained in the outline's color.

In the image below I set PEN_SIZE to 4.0 and replaced line 263 in render.rs with

sk::Color4f::new(10.0, 5.0, 2.0, 1.0),
Screen Shot 2020-12-15 at 12 28 39

P.S.: I also have an issue open at skia-safe regarding reading that Color4f data in a way that alleviates use of unsafe.

virtualritz avatar Dec 15 '20 11:12 virtualritz

Thanks.

RazrFalcon avatar Dec 15 '20 12:12 RazrFalcon

@termhn’s latest works, cint and colstodian, make the outfacing API part of this a bit more straightforward, I guess.

virtualritz avatar May 15 '21 17:05 virtualritz

The current issue is lack of time from my side. I'm not sure how those creates could help me. Skia already supports this, so I simply has to port it.

RazrFalcon avatar May 15 '21 21:05 RazrFalcon