Struct lab::Lab [] [src]

pub struct Lab {
    pub l: f32,
    pub a: f32,
    pub b: f32,
}

Fields

Methods

impl Lab
[src]

[src]

Constructs a new Lab from a three-element array of u8s

Examples

let lab = Lab::from_rgb(&[240, 33, 95]);
// Lab { l: 66.6348, a: 52.260696, b: 14.850557 }

[src]

Constructs a new Lab from a four-element array of u8s

The Lab struct does not store alpha channel information, so the last u8 representing alpha is discarded. This convenience method exists in order to easily measure colors already stored in an RGBA array.

Examples

let lab = Lab::from_rgba(&[240, 33, 95, 255]);
// Lab { l: 66.6348, a: 52.260696, b: 14.850557 }

[src]

Returns the Lab's color in RGB, in a 3-element array.

[src]

Measures the perceptual distance between the colors of one Lab and an other.

Examples

let pink = Lab { l: 66.6348, a: 52.260696, b: 14.850557 };
let websafe_pink = Lab { l: 64.2116, a: 62.519463, b: 2.8871894 };
let dist = pink.squared_distance(&websafe_pink);
// 254.23636

Trait Implementations

impl Debug for Lab
[src]

[src]

Formats the value using the given formatter. Read more

impl PartialEq for Lab
[src]

[src]

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

[src]

This method tests for !=.

impl Copy for Lab
[src]

impl Clone for Lab
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for Lab
[src]

[src]

Returns the "default value" for a type. Read more

Auto Trait Implementations

impl Send for Lab

impl Sync for Lab