pub enum BlendMode {
Show 29 variants
Src,
Dst,
SrcOver,
DstOver,
SrcIn,
DstIn,
SrcOut,
DstOut,
SrcAtop,
DstAtop,
Xor,
Plus,
Modulate,
Multiply,
Screen,
Overlay,
Darken,
Lighten,
Clear,
ColorDodge,
ColorBurn,
HardLight,
SoftLight,
Difference,
Exclusion,
Hue,
Saturation,
Color,
Luminosity,
}Expand description
How a source colour is combined with the destination underneath it.
The Porter–Duff set plus the separable blends, evaluated on premultiplied,
sRGB-encoded values. SrcOver is the ordinary “paint this on top” and the
default nearly everywhere; the rest exist because a mask or a colour filter is
often defined by one of them — a fade-out is DstIn, a tint is Modulate, a
highlight is Screen.
Variants§
Src
The source only; the destination is discarded.
Dst
The destination only; the source is discarded.
SrcOver
The source over the destination — the ordinary one.
DstOver
The destination over the source.
SrcIn
The source, kept only where the destination is opaque.
DstIn
The destination, kept only where the source is opaque.
SrcOut
The source, kept only where the destination is transparent.
DstOut
The destination, kept only where the source is transparent.
SrcAtop
The source over the destination, clipped to the destination’s shape.
DstAtop
The destination over the source, clipped to the source’s shape.
Xor
Whichever of the two is alone there.
Plus
The two added, clamped at white.
Modulate
The two multiplied, ignoring coverage — the classic tint, and what a
ShaderMask uses by default.
Multiply
The two multiplied, respecting coverage: always darker.
Screen
The inverse of multiplying the inverses: always lighter.
Overlay
Multiply where the destination is dark, Screen where it is light.
Darken
The darker of the two, per channel.
Lighten
The lighter of the two, per channel.
Clear
Nothing at all: both are dropped (milestone 646, as the rest below).
ColorDodge
The destination brightened by the inverse of the source.
ColorBurn
The destination darkened by the source.
HardLight
Multiply where the source is dark, Screen where it is light: Overlay with
the roles swapped.
SoftLight
A gentler HardLight: darkens or lightens the destination by the source.
Difference
The difference of the two, per channel: black where they match.
Exclusion
Like Difference, with less contrast.
Hue
The source’s hue, with the destination’s saturation and luminosity.
Saturation
The source’s saturation, with the destination’s hue and luminosity.
Color
The source’s hue and saturation, with the destination’s luminosity: a tint that keeps the light and shade.
Luminosity
The source’s luminosity, with the destination’s hue and saturation.
Implementations§
Trait Implementations§
impl Copy for BlendMode
impl Eq for BlendMode
impl StructuralPartialEq for BlendMode
Auto Trait Implementations§
impl Freeze for BlendMode
impl RefUnwindSafe for BlendMode
impl Send for BlendMode
impl Sync for BlendMode
impl Unpin for BlendMode
impl UnsafeUnpin for BlendMode
impl UnwindSafe for BlendMode
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.