Enum InterpolationAlphaSpace
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§
§impl Clone for InterpolationAlphaSpace
impl Clone for InterpolationAlphaSpace
§fn clone(&self) -> InterpolationAlphaSpace
fn clone(&self) -> InterpolationAlphaSpace
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for InterpolationAlphaSpace
impl Debug for InterpolationAlphaSpace
§impl Default for InterpolationAlphaSpace
impl Default for InterpolationAlphaSpace
§fn default() -> InterpolationAlphaSpace
fn default() -> InterpolationAlphaSpace
§impl Hash for InterpolationAlphaSpace
impl Hash for InterpolationAlphaSpace
§impl PartialEq for InterpolationAlphaSpace
impl PartialEq for InterpolationAlphaSpace
§fn eq(&self, other: &InterpolationAlphaSpace) -> bool
fn eq(&self, other: &InterpolationAlphaSpace) -> bool
self and other values to be equal, and is used by ==.impl Copy for InterpolationAlphaSpace
impl Eq for InterpolationAlphaSpace
impl StructuralPartialEq for InterpolationAlphaSpace
Auto Trait Implementations§
impl Freeze for InterpolationAlphaSpace
impl RefUnwindSafe for InterpolationAlphaSpace
impl Send for InterpolationAlphaSpace
impl Sync for InterpolationAlphaSpace
impl Unpin for InterpolationAlphaSpace
impl UnsafeUnpin for InterpolationAlphaSpace
impl UnwindSafe for InterpolationAlphaSpace
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more