tiny-skia
tiny-skia copied to clipboard
Add linear color space support
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).
Does this supported by Skia? Because tiny-skia is and will be just a Skia fork.
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.
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.
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),
P.S.: I also have an issue open at skia-safe regarding reading that Color4f data in a way that alleviates use of unsafe.
Thanks.
@termhn’s latest works, cint and colstodian, make the outfacing API part of this a bit more straightforward, I guess.
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.