Commit Graph

4 Commits

Author SHA1 Message Date
Tim Ledbetter
4575d23b1e LibGfx: Preserve out-of-range components in HSL to sRGB conversion 2026-04-16 12:06:10 +02:00
Tim Ledbetter
1a2ee46efe LibGfx: Add color space conversions needed for CSS color interpolation 2026-04-16 12:06:10 +02:00
Tim Ledbetter
8542c1ee7c LibGfx: Use double precision in HSV to sRGB conversion
Using float precision caused small rounding errors for inputs like
hwb(320deg 30% 40%), where the blue channel computed as 0.4999999 and
rounded down to 127 instead of 128
2026-04-16 12:06:10 +02:00
Tim Ledbetter
f36812550c LibGfx: Perform color space conversions with float precision
Color space conversions previously operated on Color's `u8` components,
losing precision at each intermediate step. Introduce a
`ColorComponents` class that stores components as floats, and move all
conversion logic into free functions that operate on `ColorComponents`.
2026-04-16 12:06:10 +02:00