palette::blend

Trait Premultiply

source
pub trait Premultiply: Sized {
    type Scalar: Real + Stimulus;

    // Required methods
    fn premultiply(self, alpha: Self::Scalar) -> PreAlpha<Self>;
    fn unpremultiply(premultiplied: PreAlpha<Self>) -> (Self, Self::Scalar);
}
Expand description

Alpha masking and unmasking.

Required Associated Types§

source

type Scalar: Real + Stimulus

The color’s component type.

Required Methods§

source

fn premultiply(self, alpha: Self::Scalar) -> PreAlpha<Self>

Alpha mask the color.

This is done by multiplying the color’s component by alpha.

source

fn unpremultiply(premultiplied: PreAlpha<Self>) -> (Self, Self::Scalar)

Alpha unmask the color, resulting in a color and transparency pair.

This is done by dividing the masked color’s component by alpha, or returning a black color if alpha is 0.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<S, T> Premultiply for Luma<S, T>
where T: Real + Stimulus + Zero + IsValidDivisor + Mul<T, Output = T> + Div<T, Output = T> + Clone, T::Mask: LazySelect<T> + Clone,

source§

impl<S, T> Premultiply for Rgb<S, T>
where T: Real + Stimulus + Zero + IsValidDivisor + Mul<T, Output = T> + Div<T, Output = T> + Clone, T::Mask: LazySelect<T> + Clone,

source§

impl<T> Premultiply for Cam16UcsJab<T>
where T: Real + Stimulus + Zero + IsValidDivisor + Mul<T, Output = T> + Div<T, Output = T> + Clone, T::Mask: LazySelect<T> + Clone,

source§

impl<T> Premultiply for Oklab<T>
where T: Real + Stimulus + Zero + IsValidDivisor + Mul<T, Output = T> + Div<T, Output = T> + Clone, T::Mask: LazySelect<T> + Clone,

source§

impl<Wp, T> Premultiply for Lab<Wp, T>
where T: Real + Stimulus + Zero + IsValidDivisor + Mul<T, Output = T> + Div<T, Output = T> + Clone, T::Mask: LazySelect<T> + Clone,

source§

impl<Wp, T> Premultiply for Luv<Wp, T>
where T: Real + Stimulus + Zero + IsValidDivisor + Mul<T, Output = T> + Div<T, Output = T> + Clone, T::Mask: LazySelect<T> + Clone,

source§

impl<Wp, T> Premultiply for Xyz<Wp, T>
where T: Real + Stimulus + Zero + IsValidDivisor + Mul<T, Output = T> + Div<T, Output = T> + Clone, T::Mask: LazySelect<T> + Clone,

source§

impl<Wp, T> Premultiply for Yxy<Wp, T>
where T: Real + Stimulus + Zero + IsValidDivisor + Mul<T, Output = T> + Div<T, Output = T> + Clone, T::Mask: LazySelect<T> + Clone,