cosmic::cosmic_theme::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<Output = T> + Div<Output = T> + Clone, <T as HasBoolMask>::Mask: LazySelect<T> + Clone,

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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