pub enum InterpolationAlphaSpace {
Premultiplied = 0,
Unpremultiplied = 1,
}Expand description
Defines how color channels should be handled when interpolating between transparent colors.
Variants§
Premultiplied = 0
Colors are interpolated with their color channels premultiplied by the alpha channel. This is almost always what you want.
Used when interpolating colors in the premultiplied alpha space, which allows for correct interpolation when colors are transparent. This matches behavior described in CSS Color Module Level 4 § 12.3.
Following the convention of CSS Color Module Level 4, in cylindrical color
spaces the hue channel is not premultiplied. If it were, interpolation would
give undesirable results. See also color::PremulColor.
Unpremultiplied = 1
Colors are interpolated without premultiplying their color channels by the alpha channel.
This causes color information to leak out of transparent colors. For example, when interpolating from a fully transparent red to a fully opaque blue in sRGB, this method will go through an intermediate purple.
Used when interpolating colors in the unpremultiplied (straight) alpha space.
This matches behavior of gradients in the HTML canvas element.
See The 2D rendering context § Fill and stroke styles.
Trait Implementations§
Source§impl Clone for InterpolationAlphaSpace
impl Clone for InterpolationAlphaSpace
Source§fn clone(&self) -> InterpolationAlphaSpace
fn clone(&self) -> InterpolationAlphaSpace
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more