Debian Codegraph @

src/encoding.rs

raw symbols SCIP
1 //! Number and color encoding traits, types and standards.
2 //!
3 //! Some color spaces, particularly RGB, may be encoded in more than one way and
4 //! may have more than one standard. These encodings and standards are
5 //! represented as type parameters in Palette, as a form of type branding, to
6 //! prevent accidental mixups.
7
8 pub use self::gamma::{F2p2, Gamma};
9 pub use self::linear::Linear;
10 pub use self::srgb::Srgb;
11
12 pub mod gamma;
13 pub mod linear;
14 pub mod srgb;
15
16 /// A transfer function from linear space.
17 pub trait FromLinear<L, E> {
18 /// Convert the color component `linear` from linear space.
19 #[must_use]
20 fn from_linear(linear: L) -> E;
21 }
22
23 /// A transfer function to linear space.
24 pub trait IntoLinear<L, E> {
25 /// Convert the color component `encoded` into linear space.
26 #[must_use]
27 fn into_linear(encoded: E) -> L;
28 }