/rust/registry/src/index.crates.io-1949cf8c6b5b557f/png-0.18.0/src/srgb.rs
Line | Count | Source |
1 | | use crate::{ScaledFloat, SourceChromaticities}; |
2 | | |
3 | | /// Get the gamma that should be substituted for images conforming to the sRGB color space. |
4 | 0 | pub fn substitute_gamma() -> ScaledFloat { |
5 | | // Value taken from https://www.w3.org/TR/2003/REC-PNG-20031110/#11sRGB |
6 | 0 | ScaledFloat::from_scaled(45455) |
7 | 0 | } |
8 | | |
9 | | /// Get the chromaticities that should be substituted for images conforming to the sRGB color space. |
10 | 0 | pub fn substitute_chromaticities() -> SourceChromaticities { |
11 | | // Values taken from https://www.w3.org/TR/2003/REC-PNG-20031110/#11sRGB |
12 | 0 | SourceChromaticities { |
13 | 0 | white: ( |
14 | 0 | ScaledFloat::from_scaled(31270), |
15 | 0 | ScaledFloat::from_scaled(32900), |
16 | 0 | ), |
17 | 0 | red: ( |
18 | 0 | ScaledFloat::from_scaled(64000), |
19 | 0 | ScaledFloat::from_scaled(33000), |
20 | 0 | ), |
21 | 0 | green: ( |
22 | 0 | ScaledFloat::from_scaled(30000), |
23 | 0 | ScaledFloat::from_scaled(60000), |
24 | 0 | ), |
25 | 0 | blue: ( |
26 | 0 | ScaledFloat::from_scaled(15000), |
27 | 0 | ScaledFloat::from_scaled(6000), |
28 | 0 | ), |
29 | 0 | } |
30 | 0 | } |