Struct LabAlpha

Source
pub struct LabAlpha<T: Float + Send + Sync> { /* private fields */ }
Expand description

Lab with alpha channel.

Implementations§

Source§

impl<T: Float + Send + Sync> LabAlpha<T>

Source

pub fn new(l: T, a: T, b: T, alpha: T) -> Self

Create a new LabAlpha instance.

Source

pub const fn lightness(&self) -> T

Get the lightness component.

Source

pub const fn a_star(&self) -> T

Get the a_star component.

Source

pub const fn b_star(&self) -> T

Get the b_star component.

Source

pub const fn alpha(&self) -> T

Get the alpha component.

Source

pub fn set_lightness(&mut self, l: T)

Set the lightness component.

Source

pub fn set_a_star(&mut self, a: T)

Set the a_star component.

Source

pub fn set_b_star(&mut self, b: T)

Set the b_star component.

Source

pub fn set_alpha(&mut self, alpha: T)

Set the alpha component.

Source

pub fn delta_e(&self, other: &Self) -> T

Calculate perceptual color difference in Lab space (CIE76 Delta E), ignoring the alpha channel.

Source

pub fn delta_e94(&self, other: &Self) -> T

Calculate perceptual color difference using the improved CIE94 Delta E formula, ignoring the alpha channel.

Trait Implementations§

Source§

impl<T: Clone + Float + Send + Sync> Clone for LabAlpha<T>

Source§

fn clone(&self) -> LabAlpha<T>

Returns a copy 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<T: Float + Send + Sync> Colour<T, { $base_components + 1 }> for LabAlpha<T>

Source§

fn from_hex(hex: &str) -> Result<Self, ParseColourError<ParseIntError>>

Create a new colour from a hex string. Read more
Source§

fn to_hex(&self) -> String

Convert the colour to a hex string.
Source§

fn from_bytes(bytes: [u8; 4]) -> Self

Create a new colour from a byte array.
Source§

fn to_bytes(self) -> [u8; 4]

Convert the colour to a byte array.
Source§

fn lerp(lhs: &Self, rhs: &Self, t: T) -> Self

Linear interpolate between two colours of the same type.
Source§

const NUM_COMPONENTS: usize = N

Number of components in the colour.
Source§

fn mix(colours: &[Self], weights: &[T]) -> Self
where Self: Clone, T: AddAssign,

Mix N by folding lerp (assumes weights sum to 1). Read more
Source§

impl<T: Float + Send + Sync> Convert<T> for LabAlpha<T>

Source§

fn to_grey(&self) -> Grey<T>

Source§

fn to_grey_alpha(&self) -> GreyAlpha<T>

Source§

fn to_hsl(&self) -> Hsl<T>

Source§

fn to_hsl_alpha(&self) -> HslAlpha<T>

Source§

fn to_hsv(&self) -> Hsv<T>

Source§

fn to_hsv_alpha(&self) -> HsvAlpha<T>

Source§

fn to_lab(&self) -> Lab<T>

Source§

fn to_lab_alpha(&self) -> LabAlpha<T>

Source§

fn to_rgb(&self) -> Rgb<T>

Source§

fn to_rgb_alpha(&self) -> RgbAlpha<T>

Source§

fn to_srgb(&self) -> Srgb<T>

Source§

fn to_srgb_alpha(&self) -> SrgbAlpha<T>

Source§

fn to_xyz(&self) -> Xyz<T>

Source§

fn to_xyz_alpha(&self) -> XyzAlpha<T>

Source§

impl<T: Debug + Float + Send + Sync> Debug for LabAlpha<T>

Source§

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

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

impl<T: Float + Send + Sync> Display for LabAlpha<T>

Source§

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

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

impl<T: Copy + Float + Send + Sync> Copy for LabAlpha<T>

Auto Trait Implementations§

§

impl<T> Freeze for LabAlpha<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for LabAlpha<T>
where T: RefUnwindSafe,

§

impl<T> Send for LabAlpha<T>

§

impl<T> Sync for LabAlpha<T>

§

impl<T> Unpin for LabAlpha<T>
where T: Unpin,

§

impl<T> UnwindSafe for LabAlpha<T>
where T: UnwindSafe,

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.