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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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,