Skip to main content

BlendMode

Enum BlendMode 

Source
pub enum BlendMode {
    Multiply,
    Screen,
    Overlay,
    Darken,
    Lighten,
    ColorDodge,
    ColorBurn,
    HardLight,
    SoftLight,
    Difference,
    Exclusion,
    PlusLighter,
}

Variants§

§

Multiply

§

Screen

§

Overlay

§

Darken

§

Lighten

§

ColorDodge

§

ColorBurn

§

HardLight

§

SoftLight

§

Difference

§

Exclusion

§

PlusLighter

Trait Implementations§

Source§

impl Clone for BlendMode

Source§

fn clone(&self) -> Self

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

Source§

impl Hash for BlendMode

Source§

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

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: &Self) -> bool

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

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

Inequality operator !=. Read more
Source§

impl ShaderEffect for BlendMode

Source§

const WGSL: &'static str = fn dodge(b: vec3<f32>, s: vec3<f32>) -> vec3<f32> { let lit = min(vec3<f32>(1.0), b / max(vec3<f32>(1.0) - s, vec3<f32>(1e-5))); return select(lit, vec3<f32>(0.0), b <= vec3<f32>(0.0)); } fn burn(b: vec3<f32>, s: vec3<f32>) -> vec3<f32> { let dark = vec3<f32>(1.0) - min(vec3<f32>(1.0), (vec3<f32>(1.0) - b) / max(s, vec3<f32>(1e-5))); return select(dark, vec3<f32>(1.0), b >= vec3<f32>(1.0)); } fn hard_light(b: vec3<f32>, s: vec3<f32>) -> vec3<f32> { let multiply = 2.0 * b * s; let screen = vec3<f32>(1.0) - 2.0 * (vec3<f32>(1.0) - b) * (vec3<f32>(1.0) - s); return select(screen, multiply, s <= vec3<f32>(0.5)); } fn soft_light(b: vec3<f32>, s: vec3<f32>) -> vec3<f32> { let curve = select(sqrt(b), ((16.0 * b - 12.0) * b + 4.0) * b, b <= vec3<f32>(0.25)); let dark = b - (vec3<f32>(1.0) - 2.0 * s) * b * (vec3<f32>(1.0) - b); let light = b + (2.0 * s - vec3<f32>(1.0)) * (curve - b); return select(light, dark, s <= vec3<f32>(0.5)); } fn mix_colors(mode: i32, b: vec3<f32>, s: vec3<f32>) -> vec3<f32> { switch mode { case 0 { return b * s; } case 1 { return b + s - b * s; } case 2 { return hard_light(s, b); } case 3 { return min(b, s); } case 4 { return max(b, s); } case 5 { return dodge(b, s); } case 6 { return burn(b, s); } case 7 { return hard_light(b, s); } case 8 { return soft_light(b, s); } case 9 { return abs(b - s); } case 10 { return b + s - 2.0 * b * s; } default { return s; } } } fn effect(in: EffectInput) -> vec4<f32> { let source = sample_content(in.local); if (source.a <= 0.0) { return vec4<f32>(0.0); } let behind = sample_backdrop(in.local); let mode = i32(param(0).x); if (mode == 11) { return vec4<f32>(source.rgb + behind.rgb * source.a, source.a); } let b = behind.rgb / max(behind.a, 1e-5); let s = source.rgb / source.a; let mixed = clamp(mix_colors(mode, b, s), vec3<f32>(0.0), vec3<f32>(1.0)); return vec4<f32>(source.rgb * (1.0 - behind.a) + mixed * source.a * behind.a, source.a); }

Source§

const INPUTS: Inputs = Inputs::BOTH

Source§

fn uniforms(&self, uniforms: &mut [f32; 16])

Source§

const CLOCK: Option<usize> = None

Source§

fn margin(&self) -> f32

Source§

fn content_blur(&self) -> f32

Source§

fn backdrop_blur(&self) -> f32

Source§

fn backdrop_reach(&self) -> Option<f32>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

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

Compare self to key and return true if they are equal.
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,