Skip to main content

BlendMode

Enum BlendMode 

Source
pub enum BlendMode {
Show 29 variants Clear, Src, Dst, SrcOver, DstOver, SrcIn, DstIn, SrcOut, DstOut, SrcAtop, DstAtop, Xor, Plus, Modulate, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Multiply, Hue, Saturation, Color, Luminosity,
}
Expand description

Blend mode used for draw primitives.

This mirrors Jetpack Compose’s blend-mode vocabulary while the renderer currently guarantees SrcOver and DstOut behavior.

Variants§

§

Clear

Clears the destination to transparent where the source draws.

§

Src

Replaces the destination with the source.

§

Dst

Keeps the destination and discards the source.

§

SrcOver

Draws the source over the destination. This is the default.

§

DstOver

Draws the destination over the source.

§

SrcIn

Keeps the source only where the destination is opaque.

§

DstIn

Keeps the destination only where the source is opaque.

§

SrcOut

Keeps the source only where the destination is transparent.

§

DstOut

Keeps the destination only where the source is transparent.

§

SrcAtop

Draws the source over the destination, only where the destination is opaque.

§

DstAtop

Draws the destination over the source, only where the source is opaque.

§

Xor

Keeps the source and the destination where the other is transparent.

§

Plus

Adds the source and destination colors and alphas.

§

Modulate

Multiplies the source and destination colors and alphas.

§

Screen

Inverts, multiplies and inverts again, which lightens the result.

§

Overlay

Multiplies or screens depending on the destination color, which raises contrast.

§

Darken

Keeps the darker color of each channel.

§

Lighten

Keeps the lighter color of each channel.

§

ColorDodge

Brightens the destination by the source color.

§

ColorBurn

Darkens the destination by the source color.

§

HardLight

Multiplies or screens depending on the source color.

§

SoftLight

A softer version of HardLight: darkens or lightens depending on the source color.

§

Difference

Subtracts the darker color from the lighter one in each channel.

§

Exclusion

Like Difference with lower contrast.

§

Multiply

Multiplies the source and destination colors, which darkens the result.

§

Hue

Takes the hue of the source with the saturation and luminosity of the destination.

§

Saturation

Takes the saturation of the source with the hue and luminosity of the destination.

§

Color

Takes the hue and saturation of the source with the luminosity of the destination.

§

Luminosity

Takes the luminosity of the source with the hue and saturation of the destination.

Implementations§

Source§

impl BlendMode

Source

pub const ALL: [BlendMode; 29]

Every mode in declaration order, so mode as u32 indexes it.

Trait Implementations§

Source§

impl Clone for BlendMode

Source§

fn clone(&self) -> BlendMode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for BlendMode

Source§

impl Debug for BlendMode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for BlendMode

Source§

fn default() -> BlendMode

Returns the “default value” for a type. Read more
Source§

impl Eq for BlendMode

Source§

impl Hash for BlendMode

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for BlendMode

Source§

fn eq(&self, other: &BlendMode) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BlendMode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyEq for T
where T: Any + PartialEq,

Source§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.