Struct deltae::DeltaE[][src]

pub struct DeltaE { /* fields omitted */ }
Expand description

The measured difference between two colors

There are many different methods of calculating color difference. Different methods have a specific purpose, mainly in determining the level of tolerance for describing the difference between two colors. Regardless of the DEMethod used, DeltaE is always calculated based on the LabValues of the two colors.

Implementations

New DeltaE from two colors and a DEMethod.

use deltae::{LabValue, DeltaE, DEMethod::DE2000};

let lab0 = LabValue::new(89.73, 1.88, -6.96).unwrap();
let lab1 = LabValue::new(95.08, -0.17, -10.81).unwrap();
let de0 = DeltaE::new(&lab0, &lab1, DE2000);
assert_eq!(de0, 5.316941);

Recalculate DeltaE with another DEMethod

use deltae::{Delta, DeltaE, LabValue, DEMethod};

let lab0 = LabValue::new(89.73, 1.88, -6.96).unwrap();
let lab1 = LabValue::new(95.08, -0.17, -10.81).unwrap();
let de2000 = lab0.delta(lab1, DEMethod::DE2000);
let de1976 = de2000.with_method(DEMethod::DE1976);
assert_eq!(de1976, 6.902716);

Return a reference to the DeltaE method used in the calculation

Return a reference to the DeltaE value

Return a reference to the reference LabValue used in the calculation. A reference color is the base color to which the sample color is being compared.

Return a reference to the sample LabValue used in the calculation. A sample color is the color being compared to the reference color.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

One should be careful when ordering DeltaE. A DE2000:1.0 value is not necessarily the same amount of color difference as a amount of color difference DE1976:1.0 value.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Rounds the value to a number of decimal places

Return a tolerance value

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.