colr_types/device.rs
1//! Device-dependent color conversion trait.
2
3/// Convert from a device-dependent color, given a profile.
4///
5/// Analogous to [`From`], but parameterized by a profile type `Self::Profile`
6/// that provides the colorimetric description of the source device space.
7/// Use `()` as the profile type for naive, profile-free conversions.
8pub trait FromDevice<Src>: Sized {
9 /// The profile type required to perform this conversion.
10 type Profile;
11
12 /// Convert `src` to `Self` using `profile`.
13 fn from_device(src: Src, profile: &Self::Profile) -> Self;
14}