pub enum BlendMode {
Show 28 variants
Normal,
Multiply,
Add,
Screen,
Subtract,
Min,
Max,
Erase,
Overlay,
HardLight,
SoftLight,
PinLight,
HardMix,
VividLight,
LinearLight,
ColorBurn,
ColorDodge,
LinearBurn,
LinearDodge,
Darken,
Lighten,
Difference,
Exclusion,
Negation,
Divide,
Saturation,
Color,
Luminosity,
}Expand description
Blend mode for compositing a renderable onto its target.
Mirrors the PixiJS v8 catalog. See the module docs for the
standard-vs-advanced distinction.
Variants§
Normal
Source-over alpha blending. src.a * src + (1 - src.a) * dst.
Multiply
dst * src + (1 - src.a) * dst — darkens.
Add
src + (1 - src.a) * dst — additive.
Screen
1 - (1 - src) * (1 - dst) — softer additive.
Subtract
dst - src clamped to [0, 1].
Min
min(src, dst) per channel.
Max
max(src, dst) per channel.
Erase
dst * (1 - src.a) — erases dst proportional to src alpha.
Overlay
(base < 0.5) ? 2·base·blend : 1 - 2·(1-base)·(1-blend).
HardLight
Overlay with the roles swapped — (blend < 0.5) ? ….
SoftLight
Photoshop’s W3C-defined soft-light formula.
PinLight
Pixel-wise pin: (blend < 0.5) ? min(base, 2·blend) : max(base, 2·blend - 1).
HardMix
VividLight thresholded to {0, 1} per channel.
VividLight
(blend < 0.5) ? color-burn(base, 2·blend) : color-dodge(base, 2·(blend - 0.5)).
LinearLight
base + 2·blend - 1 clamped.
ColorBurn
(blend == 0) ? 0 : 1 - min(1, (1-base) / blend).
ColorDodge
(blend == 1) ? 1 : min(1, base / (1-blend)).
LinearBurn
base + blend - 1 clamped.
LinearDodge
base + blend clamped (a.k.a. linear-dodge / additive).
Darken
min(base, blend).
Lighten
max(base, blend).
Difference
abs(base - blend).
Exclusion
base + blend - 2·base·blend.
Negation
1 - abs(1 - base - blend).
Divide
base / blend. Not GPU-native (needs read-modify-write on dst).
Saturation
HSL: keep saturation of foreground, hue+lum of backdrop.
Color
HSL: keep hue+saturation of foreground, lum of backdrop.
Luminosity
HSL: keep lum of foreground, hue+saturation of backdrop.
Implementations§
Source§impl BlendMode
impl BlendMode
Sourcepub const fn is_advanced(self) -> bool
pub const fn is_advanced(self) -> bool
Whether this mode requires the offscreen filter path (Tier C).
Modes that don’t require it return Some(BlendState) from
Self::native_blend_state.
Sourcepub const fn native_blend_state(self) -> Option<BlendState>
pub const fn native_blend_state(self) -> Option<BlendState>
The wgpu blend state for this mode, if it can be expressed as a
single GPU blend equation. Returns None for advanced modes.
Sourcepub const fn css_name(self) -> &'static str
pub const fn css_name(self) -> &'static str
CSS-style kebab-case identifier — matches PixiJS v8’s
Container.blendMode string values.
Sourcepub fn all() -> impl ExactSizeIterator<Item = BlendMode> + DoubleEndedIterator
pub fn all() -> impl ExactSizeIterator<Item = BlendMode> + DoubleEndedIterator
Iterate every variant. Useful for table-driven tests + the blend-modes storybook gallery.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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<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§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().