Trait cosmic::cosmic_theme::palette::blend::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§
Required Methods§
sourcefn premultiply(self, alpha: Self::Scalar) -> PreAlpha<Self>
fn premultiply(self, alpha: Self::Scalar) -> PreAlpha<Self>
Alpha mask the color.
This is done by multiplying the color’s component by alpha
.
sourcefn unpremultiply(premultiplied: PreAlpha<Self>) -> (Self, Self::Scalar)
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.