pub struct Profile {Show 15 fields
pub version: (u8, u8),
pub class: ProfileClass,
pub color_space: ColorSpace,
pub pcs: Pcs,
pub rendering_intent: Intent,
pub description: String,
pub copyright: String,
pub white_point: [f64; 3],
pub black_point: Option<[f64; 3]>,
pub chad: Option<Mat3>,
pub matrix: Option<Mat3>,
pub trc: Option<[Curve; 3]>,
pub gray_trc: Option<Curve>,
pub a2b: [Option<Lut>; 3],
pub b2a: [Option<Lut>; 3],
/* private fields */
}Expand description
A parsed ICC profile.
Fields§
§version: (u8, u8)Major version and minor.bugfix byte (e.g. (4, 0x30) for 4.3, (2, 0x10) for 2.1).
class: ProfileClass§color_space: ColorSpace§pcs: Pcs§rendering_intent: Intent§description: String§copyright: String§white_point: [f64; 3]wtpt as stored (XYZ; D50 when absent).
black_point: Option<[f64; 3]>bkpt when present.
chad: Option<Mat3>chad chromatic adaptation matrix when present.
matrix: Option<Mat3>Colorant matrix (columns rXYZ, gXYZ, bXYZ), D50-adapted.
trc: Option<[Curve; 3]>§gray_trc: Option<Curve>§a2b: [Option<Lut>; 3]A2B0/A2B1/A2B2 (perceptual, colorimetric, saturation).
b2a: [Option<Lut>; 3]Implementations§
Source§impl Profile
impl Profile
Sourcepub fn to_bytes(&self) -> Arc<Vec<u8>> ⓘ
pub fn to_bytes(&self) -> Arc<Vec<u8>> ⓘ
The ICC bytes of this profile: the original bytes when it was parsed, otherwise a fresh ICC v4 encoding.
Sourcepub fn with_encoded_bytes(self) -> Profile
pub fn with_encoded_bytes(self) -> Profile
Re-encodes the model as ICC v4 bytes and caches them (used for built-in profiles).
pub fn channels(&self) -> usize
Sourcepub fn content_hash(&self) -> u64
pub fn content_hash(&self) -> u64
Hash of the profile’s ICC bytes (stable within a process; used as a cache key).
Sourcepub fn same_colors(&self, other: &Profile) -> bool
pub fn same_colors(&self, other: &Profile) -> bool
Whether self and other describe the same colours: same colour space, and every sample
of a device-value grid has the same colour through both (relative colorimetric, within
SAME_COLORS_MAX_DELTA_E). Different encodings of one space are the same colours: the
sRGB IEC61966-2.1 Photoshop embeds (v2, 1024-entry tables) and the built-in sRGB (v4,
parametric curves) differ in every byte. Colours are compared rather than round-tripped
because CMYK → PCS → CMYK is not an identity even through a single profile.
Sourcepub fn media_white(&self) -> [f64; 3]
pub fn media_white(&self) -> [f64; 3]
Media white point used for ICC-absolute colorimetry: wtpt, except for v2 display
profiles whose wtpt records the (unadapted) display white; those are treated as D50.
Sourcepub fn gray_as_rgb(&self) -> Option<Profile>
pub fn gray_as_rgb(&self) -> Option<Profile>
An RGB view of a gray TRC profile: each of R, G, B carries the gray curve and maps to a
third of the white, so (v, v, v) has exactly the colour of gray v. Used for
composites of gray documents, which are stored as replicated RGB.
Sourcepub fn is_matrix_shaper(&self) -> bool
pub fn is_matrix_shaper(&self) -> bool
true for matrix/TRC RGB or gray TRC profiles without LUTs.
Sourcepub fn can_be_destination(&self) -> bool
pub fn can_be_destination(&self) -> bool
Whether colours can be converted into this profile for every intent. Input profiles with only AToB tables (Apple’s Wide Color Sharing Profile on iPhone photos) can’t: they describe a source but have no PCS → device path.
Sourcepub fn supports_intent(&self, intent: Intent, input: bool) -> bool
pub fn supports_intent(&self, intent: Intent, input: bool) -> bool
Whether the profile has a dedicated table for intent (matrix profiles support every
intent colorimetrically).
Trait Implementations§
impl StructuralPartialEq for Profile
Auto Trait Implementations§
impl !Freeze for Profile
impl Forget for Profile
impl Move for Profile
impl RefUnwindSafe for Profile
impl Send for Profile
impl Sync for Profile
impl Unpin for Profile
impl UnsafeUnpin for Profile
impl UnwindSafe for Profile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more