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 moreSource§impl Debug for InterpolationAlphaSpace
impl Debug for InterpolationAlphaSpace
Source§impl Default for InterpolationAlphaSpace
impl Default for InterpolationAlphaSpace
Source§fn default() -> InterpolationAlphaSpace
fn default() -> InterpolationAlphaSpace
Source§impl PartialEq for InterpolationAlphaSpace
impl PartialEq for InterpolationAlphaSpace
impl Copy 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 UnwindSafe for InterpolationAlphaSpace
Blanket Implementations§
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.