diff options
author | Valentin Popov <valentin@popov.link> | 2024-01-08 00:21:28 +0300 |
---|---|---|
committer | Valentin Popov <valentin@popov.link> | 2024-01-08 00:21:28 +0300 |
commit | 1b6a04ca5504955c571d1c97504fb45ea0befee4 (patch) | |
tree | 7579f518b23313e8a9748a88ab6173d5e030b227 /vendor/png/src/srgb.rs | |
parent | 5ecd8cf2cba827454317368b68571df0d13d7842 (diff) | |
download | fparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.tar.xz fparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.zip |
Initial vendor packages
Signed-off-by: Valentin Popov <valentin@popov.link>
Diffstat (limited to 'vendor/png/src/srgb.rs')
-rw-r--r-- | vendor/png/src/srgb.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/png/src/srgb.rs b/vendor/png/src/srgb.rs new file mode 100644 index 0000000..2780e42 --- /dev/null +++ b/vendor/png/src/srgb.rs @@ -0,0 +1,30 @@ +use crate::{ScaledFloat, SourceChromaticities}; + +/// Get the gamma that should be substituted for images conforming to the sRGB color space. +pub fn substitute_gamma() -> ScaledFloat { + // Value taken from https://www.w3.org/TR/2003/REC-PNG-20031110/#11sRGB + ScaledFloat::from_scaled(45455) +} + +/// Get the chromaticities that should be substituted for images conforming to the sRGB color space. +pub fn substitute_chromaticities() -> SourceChromaticities { + // Values taken from https://www.w3.org/TR/2003/REC-PNG-20031110/#11sRGB + SourceChromaticities { + white: ( + ScaledFloat::from_scaled(31270), + ScaledFloat::from_scaled(32900), + ), + red: ( + ScaledFloat::from_scaled(64000), + ScaledFloat::from_scaled(33000), + ), + green: ( + ScaledFloat::from_scaled(30000), + ScaledFloat::from_scaled(60000), + ), + blue: ( + ScaledFloat::from_scaled(15000), + ScaledFloat::from_scaled(6000), + ), + } +} |