# 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 `LabValue`s of the two colors.

## Implementations

[src]

### impl DeltaE

[src]

#### pub fn new<A, B>(a: A, b: B, method: DEMethod) -> DeltaE where
A: Delta,
B: Delta,

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);

[src]

#### pub fn with_method(self, method: DEMethod) -> Self

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);

[src]

#### pub fn method(&self) -> &DEMethod

Return a reference to the `DeltaE` method used in the calculation

[src]

#### pub fn value(&self) -> &f32

Return a reference to the `DeltaE` value

[src]

#### pub fn reference(&self) -> &LabValue

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.

[src]

#### pub fn sample(&self) -> &LabValue

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

[src]

### impl Clone for DeltaE

[src]

#### fn clone(&self) -> DeltaE

Returns a copy of the value. Read more

1.0.0[src]

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

Performs copy-assignment from `source`. Read more

[src]

### impl Debug for DeltaE

[src]

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

Formats the value using the given formatter. Read more

[src]

### impl Display for DeltaE

[src]

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

Formats the value using the given formatter. Read more

[src]

### impl PartialEq<DeltaE> for DeltaE

[src]

#### fn eq(&self, other: &Self) -> bool

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

1.0.0[src]

#### fn ne(&self, other: &Rhs) -> bool

This method tests for `!=`.

[src]

### impl PartialEq<f32> for DeltaE

[src]

#### fn eq(&self, f: &f32) -> bool

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

1.0.0[src]

#### fn ne(&self, other: &Rhs) -> bool

This method tests for `!=`.

[src]

### impl PartialOrd<DeltaE> for DeltaE

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.

[src]

#### fn partial_cmp(&self, other: &Self) -> Option<Ordering>

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

1.0.0[src]

#### fn lt(&self, other: &Rhs) -> bool

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

1.0.0[src]

#### fn le(&self, other: &Rhs) -> bool

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

1.0.0[src]

#### fn gt(&self, other: &Rhs) -> bool

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

1.0.0[src]

#### fn ge(&self, other: &Rhs) -> bool

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

[src]

### impl Round for DeltaE

[src]

#### fn round_to(self, places: i32) -> Self

Rounds the value to a number of decimal places

[src]

### impl Tolerance for DeltaE

[src]

#### fn tolerance(self) -> f32

Return a tolerance value

[src]

### impl Copy for DeltaE

## Auto Trait Implementations

### impl RefUnwindSafe for DeltaE

### impl Send for DeltaE

### impl Sync for DeltaE

### impl Unpin for DeltaE

### impl UnwindSafe for DeltaE

## Blanket Implementations

[src]

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

[src]

#### pub fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more

[src]

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

[src]

#### pub fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

[src]

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

[src]

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

Mutably borrows from an owned value. Read more

[src]

### impl<T> From<T> for T

[src]

#### pub fn from(t: T) -> T

Performs the conversion.

[src]

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

[src]

#### pub fn into(self) -> U

Performs the conversion.

[src]

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

#### type Owned = T

The resulting type after obtaining ownership.

[src]

#### pub fn to_owned(&self) -> T

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

[src]

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

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

recently added

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

[src]

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

[src]

#### pub default fn to_string(&self) -> String

Converts the given value to a `String`. Read more

[src]

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

#### type Error = Infallible

The type returned in the event of a conversion error.

[src]

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

Performs the conversion.

[src]

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

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

The type returned in the event of a conversion error.

[src]

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

Performs the conversion.