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.
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.