Is SkColor assumed to be linear, or gamma corrected?

360 views
Skip to first unread message

שחר לנגבהיים

unread,
Jan 28, 2020, 1:51:26 AM1/28/20
to skia-discuss
Is SkColor assumed to be in linear colorspace, or gamma corrected? 
When I manipulate colors, should I gamma-correct it before sending it to drawing?

Brian Osman

unread,
Jan 28, 2020, 8:32:43 AM1/28/20
to skia-d...@googlegroups.com
SkColor is always assumed to be sRGB (both sRGB gamut, and encoded with the sRGB transfer function). Skia performs nearly all color math in the color space of the SkSurface that you're drawing to. Most clients don't actually want linear color math, so if the destination surface is sRGB (for example), then math like blending is done on colors that are encoded by the transfer function. To get linear math/blending, you can put a linear color space on the surface (eg: SkColorSpace::MakeSRGBLinear()). If you do that, the precision with a 32-bit (8888) color type is going to be poor, so you may want to use a higher precision format like F16 (kRGBA_F16_SkColorType).

‪On Tue, Jan 28, 2020 at 1:51 AM ‫שחר לנגבהיים‬‎ <nih...@gmail.com> wrote:‬
Is SkColor assumed to be in linear colorspace, or gamma corrected? 
When I manipulate colors, should I gamma-correct it before sending it to drawing?

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/6f0bf77e-d7ff-43be-9b2c-19e26d29cb19%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages