Skip to main content

ChromaticAdaptationTransform

Struct ChromaticAdaptationTransform 

Source
pub struct ChromaticAdaptationTransform { /* private fields */ }
Expand description

A 3x3 matrix transform for adapting colors between different illuminant white points.

Chromatic adaptation transforms (CATs) model how the human visual system adjusts to changes in illumination. Each transform defines a matrix that converts XYZ tristimulus values into a cone-response-like space where adaptation scaling is applied.

Implementations§

Source§

impl ChromaticAdaptationTransform

Source

pub const BRADFORD: Self

Available on crate feature cat-bradford only.

The Bradford chromatic adaptation transform.

Widely considered the best general-purpose CAT. Used as the default.

Source

pub const DEFAULT: Self = Self::BRADFORD

Available on crate feature cat-bradford only.

The default CAT (Bradford when the cat-bradford feature is enabled).

Source§

impl ChromaticAdaptationTransform

Source

pub const CAT02: Self

Available on crate feature cat-cat02 only.

The CAT02 chromatic adaptation transform from the CIECAM02 color appearance model.

Source§

impl ChromaticAdaptationTransform

Source

pub const CAT16: Self

Available on crate feature cat-cat16 only.

The CAT16 chromatic adaptation transform from the CAM16 color appearance model.

Source§

impl ChromaticAdaptationTransform

Source

pub const CMC_CAT2000: Self

Available on crate feature cat-cmc-cat2000 only.

The CMC CAT2000 chromatic adaptation transform.

Source§

impl ChromaticAdaptationTransform

Source

pub const CMC_CAT97: Self

Available on crate feature cat-cmc-cat97 only.

The CMC CAT97 chromatic adaptation transform.

Source§

impl ChromaticAdaptationTransform

Source

pub const FAIRCHILD: Self

Available on crate feature cat-fairchild only.

The Fairchild chromatic adaptation transform.

Source§

impl ChromaticAdaptationTransform

Source

pub const HPE: Self = Self::HUNT_POINTER_ESTEVEZ

Available on crate feature cat-hunt-pointer-estevez only.

Shorthand alias for Self::HUNT_POINTER_ESTEVEZ.

Source

pub const HUNT_POINTER_ESTEVEZ: Self

Available on crate feature cat-hunt-pointer-estevez only.

The Hunt-Pointer-Estevez chromatic adaptation transform.

Source§

impl ChromaticAdaptationTransform

Source

pub const SHARP: Self

Available on crate feature cat-sharp only.

The Sharp chromatic adaptation transform (Süsstrunk et al.).

Source§

impl ChromaticAdaptationTransform

Source

pub const VON_KRIES: Self

Available on crate feature cat-von-kries only.

The Von Kries chromatic adaptation transform.

A simple diagonal adaptation using Hunt-Pointer-Estevez-like cone responses.

Source§

impl ChromaticAdaptationTransform

Source

pub const XYZ_SCALING: Self

XYZ scaling (identity matrix) chromatic adaptation.

The simplest possible adaptation — scales each XYZ channel independently. Always available regardless of feature flags.

Source§

impl ChromaticAdaptationTransform

Source

pub const fn new(name: &'static str, matrix: [[f64; 3]; 3]) -> Self

Creates a new chromatic adaptation transform from a name and 3x3 matrix.

Source

pub fn adapt( &self, color: impl Into<Xyz>, reference_white: impl Into<Xyz>, target_white: impl Into<Xyz>, ) -> Xyz

Adapts a color from one white point to another.

Converts the color to a cone-response space using this transform’s matrix, scales each cone channel by the ratio of target to reference white, then converts back to XYZ.

Source

pub fn inverse(&self) -> Matrix3

Returns the inverse of the transformation matrix.

Source

pub fn matrix(&self) -> Matrix3

Returns the transformation matrix.

Source

pub fn name(&self) -> &'static str

Returns the name of this transform (e.g., “Bradford”, “CAT16”).

Trait Implementations§

Source§

impl Clone for ChromaticAdaptationTransform

Source§

fn clone(&self) -> ChromaticAdaptationTransform

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChromaticAdaptationTransform

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ChromaticAdaptationTransform

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for ChromaticAdaptationTransform

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult

Formats the value using the given formatter. Read more
Source§

impl Copy for ChromaticAdaptationTransform

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.