Skip to main content

BlendMode

Enum BlendMode 

Source
#[non_exhaustive]
pub enum BlendMode {
Show 17 variants Alpha, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity, Add, Multiply,
}
Expand description

Blend mode for a VectorMesh, following the CSS mix-blend-mode vocabulary used by SVG/Lottie-style artwork. All variants are wired into the renderer: separable modes use fixed-function blending, the rest (marked below) isolate the mesh into a graphics layer and composite it with a custom shader.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Alpha

Standard premultiplied alpha blending (normal).

§

Screen

screen: 1 - (1 - S) * (1 - D). Fixed-function.

§

Overlay

overlay: Multiply for dark backdrops, Screen for light ones.

§

Darken

darken: per-channel min(S, D). Fixed-function.

§

Lighten

lighten: per-channel max(S, D). Fixed-function.

§

ColorDodge

color-dodge: brightens the backdrop toward the source color.

§

ColorBurn

color-burn: darkens the backdrop toward the source color.

§

HardLight

hard-light: Overlay with source and backdrop swapped.

§

SoftLight

soft-light: subtle Overlay variant.

§

Difference

difference: per-channel |S - D|. Needs the backdrop (fixed-function subtract only covers S - D), so it composites via an isolated layer.

§

Exclusion

exclusion: like difference with lower contrast.

§

Hue

hue: source hue with backdrop saturation and luminosity.

§

Saturation

saturation: source saturation with backdrop hue and luminosity.

§

Color

color: source hue and saturation with backdrop luminosity.

§

Luminosity

luminosity: source luminosity with backdrop hue and saturation.

§

Add

Additive (screen-space light). Fixed-function.

§

Multiply

multiply: per-channel S * D. Fixed-function.

Implementations§

Source§

impl BlendMode

Source

pub fn needs_isolation(self) -> bool

Modes implemented with fixed-function hardware blending on the mesh pipeline. Everything else isolates the mesh into a graphics layer and composites it with the backdrop-blend shader.

Source

pub fn shader_mode(self) -> u32

Discriminant consumed by blend_layer.wgsl (mode flat varying).

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

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 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> 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<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> 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.