Struct IsolatedEffects

Source
pub struct IsolatedEffects {
    pub opacity: f32,
    pub blur_radius_px: f32,
    pub backdrop_blur_radius_px: f32,
    pub blend_mode: BlendMode,
}
Expand description

Post-effects applied to an isolated offscreen pass before compositing.

Values are stored without clamping. Render backends decide how to handle opacity outside 0.0..=1.0, non-finite values, and blur radii larger than their resource limits. Self::is_noop uses an opacity tolerance of 0.001 and treats non-positive blur radii as disabled.

§Examples

use ailloli_ui_runtime::{BlendMode, IsolatedEffects};
let effects = IsolatedEffects::default();
assert_eq!(effects.opacity, 1.0);
assert_eq!(effects.blend_mode, BlendMode::Normal);
assert!(effects.is_noop());

Fields§

§opacity: f32

Group opacity multiplier (1.0 = opaque group).

§blur_radius_px: f32

Gaussian-ish blur radius in physical pixels (0.0 = disabled) on layer content.

§backdrop_blur_radius_px: f32

Blur of content already rendered behind this layer (backdrop filter backdrop).

§blend_mode: BlendMode

Blend operation used when recombining the isolated pass.

Implementations§

Source§

impl IsolatedEffects

Provides the operations defined for IsolatedEffects.

Source

pub fn is_noop(&self) -> bool

No offscreen pass required: render in the main single pass.

This returns true exactly when opacity is at least 0.999, both blur radii are at most zero, and blend mode is BlendMode::Normal. Thus opacity above one and negative blur values are still considered no-op; NaN in any numeric field forces false through ordered comparisons.

§Examples
use ailloli_ui_runtime::IsolatedEffects;
let mut effects = IsolatedEffects::default();
effects.opacity = 0.998;
assert!(!effects.is_noop());
effects.opacity = 1.0;
effects.blur_radius_px = -1.0;
assert!(effects.is_noop());
Source

pub fn needs_offscreen(&self) -> bool

Whether this layer must be rendered to an offscreen target.

This is exactly the negation of Self::is_noop; it does not check backend support or allocate a target.

§Examples
use ailloli_ui_runtime::{BlendMode, IsolatedEffects};
let effects = IsolatedEffects { blend_mode: BlendMode::Multiply, ..IsolatedEffects::default() };
assert!(effects.needs_offscreen());

Trait Implementations§

Source§

impl Clone for IsolatedEffects

Source§

fn clone(&self) -> IsolatedEffects

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IsolatedEffects

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IsolatedEffects

Implements the Default contract for IsolatedEffects.

Source§

fn default() -> Self

Constructs the documented default value.

Source§

impl PartialEq for IsolatedEffects

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 Copy for IsolatedEffects

Source§

impl StructuralPartialEq for IsolatedEffects

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<A> IntoClickAction<A> for A
where A: Clone + 'static,

Source§

fn into_click_action(self) -> ClickAction<A>

Implements the into_click_action helper used by this module.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<T> Brush for T
where T: Clone + PartialEq + Default + Debug,

§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Props for T
where T: Clone + 'static,