Skip to main content

BlendMode

Enum BlendMode 

Source
pub enum BlendMode {
Show 40 variants Normal, Multiply, Screen, Overlay, SoftLight, HardLight, ColorDodge, ColorBurn, Darken, Lighten, Difference, Exclusion, Add, Subtract, And, Average, Bleach, Divide, Extremity, Freeze, Geometric, Glow, GrainExtract, GrainMerge, HardMix, HardOverlay, Harmonic, Heat, Interpolate, LinearLight, Multiply128, Negation, Or, Phoenix, PinLight, Reflect, SoftDifference, Stain, VividLight, Xor,
}
Expand description

Specifies how two video layers are combined during compositing.

Each variant corresponds 1:1 to a mode of FFmpeg’s blend filter all_mode option (40 modes total, matching vf_blend.c). BlendMode::Normal is the standard alpha-over composite, built via the overlay filter; every other variant is built via blend all_mode=<token>. The canonical token for each variant is provided by FfmpegToken (all variants map to a valid token).

For Porter-Duff alpha compositing (over / under / in / out / atop / xor) use CompositeOp instead — that is a separate concept (alpha channel operators, not pixel-value blend modes). Note BlendMode::Xor is the arithmetic xor blend, distinct from CompositeOp::Xor.

Variants§

§

Normal

Standard alpha-over composite (top * opacity + bottom * (1 − opacity)). Built via overlay=format=auto:shortest=1 (token: normal).

§

Multiply

Multiply per-channel pixel values; darkens. blend all_mode=multiply.

§

Screen

Inverse of multiply; lightens. blend all_mode=screen.

§

Overlay

Multiply/Screen by base luminance. blend all_mode=overlay.

§

SoftLight

Gentle contrast enhancement. blend all_mode=softlight.

§

HardLight

Harsher Overlay driven by the top layer. blend all_mode=hardlight.

§

ColorDodge

Brightens the base. blend all_mode=dodge.

§

ColorBurn

Darkens the base. blend all_mode=burn.

§

Darken

Keeps the darker pixel per channel. blend all_mode=darken.

§

Lighten

Keeps the lighter pixel per channel. blend all_mode=lighten.

§

Difference

Per-channel absolute difference. blend all_mode=difference.

§

Exclusion

Lower-contrast Difference. blend all_mode=exclusion.

§

Add

Linear addition, clamped. blend all_mode=addition.

§

Subtract

Linear subtraction, clamped. blend all_mode=subtract.

§

And

Bitwise AND of the two pixels. blend all_mode=and.

§

Average

Arithmetic mean of the two pixels. blend all_mode=average.

§

Bleach

Bleach-bypass look. blend all_mode=bleach.

§

Divide

Per-channel division. blend all_mode=divide.

§

Extremity

Extremity (distance from mid-grey). blend all_mode=extremity.

§

Freeze

Freeze. blend all_mode=freeze.

§

Geometric

Geometric mean. blend all_mode=geometric.

§

Glow

Glow. blend all_mode=glow.

§

GrainExtract

Grain extract (alias of difference128). blend all_mode=grainextract.

§

GrainMerge

Grain merge (alias of addition128). blend all_mode=grainmerge.

§

HardMix

Hard mix. blend all_mode=hardmix.

§

HardOverlay

Hard overlay. blend all_mode=hardoverlay.

§

Harmonic

Harmonic mean. blend all_mode=harmonic.

§

Heat

Heat. blend all_mode=heat.

§

Interpolate

Linear interpolation. blend all_mode=interpolate.

§

LinearLight

Linear light. blend all_mode=linearlight.

§

Multiply128

Multiply scaled by 128. blend all_mode=multiply128.

§

Negation

Negation. blend all_mode=negation.

§

Or

Bitwise OR of the two pixels. blend all_mode=or.

§

Phoenix

Phoenix. blend all_mode=phoenix.

§

PinLight

Pin light. blend all_mode=pinlight.

§

Reflect

Reflect. blend all_mode=reflect.

§

SoftDifference

Soft difference. blend all_mode=softdifference.

§

Stain

Stain. blend all_mode=stain.

§

VividLight

Vivid light. blend all_mode=vividlight.

§

Xor

Arithmetic XOR of the two pixels. blend all_mode=xor. Distinct from the Porter-Duff CompositeOp::Xor.

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 Eq for BlendMode

Source§

impl FfmpegToken for BlendMode

Source§

fn ffmpeg_token(&self) -> Option<&'static str>

Source§

impl PartialEq for BlendMode

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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> 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.