#[repr(u32)]pub enum BlendMode {
Show 44 variants
Normal = 0,
Multiply = 1,
Screen = 2,
Overlay = 3,
SoftLight = 4,
HardLight = 5,
ColorDodge = 6,
ColorBurn = 7,
Difference = 8,
Exclusion = 9,
Add = 10,
Subtract = 11,
Darken = 12,
Lighten = 13,
Hue = 14,
Saturation = 15,
Color = 16,
Luminosity = 17,
And = 18,
Average = 19,
Bleach = 20,
Divide = 21,
Extremity = 22,
Freeze = 23,
Geometric = 24,
Glow = 25,
GrainExtract = 26,
GrainMerge = 27,
HardMix = 28,
HardOverlay = 29,
Harmonic = 30,
Heat = 31,
Interpolate = 32,
LinearLight = 33,
Multiply128 = 34,
Negation = 35,
Or = 36,
Phoenix = 37,
PinLight = 38,
Reflect = 39,
SoftDifference = 40,
Stain = 41,
VividLight = 42,
Xor = 43,
}Expand description
Pixel-value blend modes.
The discriminant is the value written into the shader’s mode uniform, so
variants are only ever appended, never renumbered. Each doc comment gives
the normalised formula in terms of base and overlay (see the module docs
for how those map onto FFmpeg’s A and B).
Variants§
Normal = 0
Overlay replaces base.
Multiply = 1
base × overlay.
Screen = 2
1 − (1−base)(1−overlay).
Overlay = 3
Multiply below 50% grey, Screen above.
SoftLight = 4
base² + 2·overlay·base·(1−base).
HardLight = 5
Hard light — Overlay with base/overlay swapped.
ColorDodge = 6
base ≥ 1 ? base : min(1, overlay/(1−base)).
ColorBurn = 7
base ≤ 0 ? base : max(0, 1−(1−overlay)/base).
Difference = 8
|base − overlay|.
Exclusion = 9
base + overlay − 2·base·overlay.
Add = 10
clamp(base + overlay, 0, 1).
Subtract = 11
clamp(base − overlay, 0, 1).
Darken = 12
min(base, overlay).
Lighten = 13
max(base, overlay).
Hue = 14
Overlay hue + base saturation + base lightness.
Saturation = 15
Base hue + overlay saturation + base lightness.
Color = 16
Overlay hue + overlay saturation + base lightness.
Luminosity = 17
Base hue + base saturation + overlay lightness.
And = 18
Bitwise and of the two 8-bit samples.
Average = 19
(base + overlay)/2.
Bleach = 20
1 − base − overlay.
Divide = 21
overlay == 0 ? 1 : base/overlay.
Extremity = 22
|1 − base − overlay|.
Freeze = 23
overlay == 0 ? 0 : 1 − min((1−base)²/overlay, 1).
Geometric = 24
sqrt(max(base,0)·max(overlay,0)).
Glow = 25
base ≥ 1 ? base : min(1, overlay²/(1−base)).
GrainExtract = 26
0.5 + base − overlay (FFmpeg’s difference128).
GrainMerge = 27
base + overlay − 0.5 (FFmpeg’s addition128).
HardMix = 28
base < 1 − overlay ? 0 : 1.
HardOverlay = 29
base ≥ 1 ? 1 : min(1, base > 0.5 ? overlay/(2−2·base) : 2·base·overlay).
Harmonic = 30
base + overlay == 0 ? 0 : 2·base·overlay/(base + overlay).
Heat = 31
base == 0 ? 0 : 1 − min((1−overlay)²/base, 1).
Interpolate = 32
(2 − cos(base·π) − cos(overlay·π))/4.
LinearLight = 33
overlay + 2·base − 1.
The C branches on overlay < 0.5, but both arms collapse to the same
expression once MAX == 2·HALF, which holds in the DEPTH == 32 branch.
The 8-bit path differs by one LSB.
Multiply128 = 34
8·(base−0.5)·overlay + 0.5.
Negation = 35
1 − |1 − base − overlay|.
Or = 36
Bitwise or of the two 8-bit samples.
Phoenix = 37
min(base, overlay) − max(base, overlay) + 1.
PinLight = 38
overlay < 0.5 ? min(base, 2·overlay) : max(base, 2·overlay − 1).
Reflect = 39
overlay ≥ 1 ? overlay : min(1, base²/(1−overlay)).
SoftDifference = 40
base > overlay ? (overlay ≥ 1 ? 0 : (base−overlay)/(1−overlay))
: (overlay ≤ 0 ? 0 : (overlay−base)/overlay).
Stain = 41
2 − base − overlay.
VividLight = 42
base < 0.5 ? burn(2·base, overlay) : dodge(2·base − 1, overlay).
Xor = 43
Bitwise xor of the two 8-bit samples.
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<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.