Skip to main content

BlurStrength

Struct BlurStrength 

Source
pub struct BlurStrength(/* private fields */);
Expand description

Blur radius in logical points.

Core resolves this to a physical-pixel radius — the one algorithm-agnostic step. The GPU application of the resulting parameters (allocating the pyramid textures, binding the per-pass offset uniforms, the draws) lives in the backend; the GPU-free policy that produces them — the Gaussian sigma/taps and the dual-Kawase level/half-pixel math — lives in the crate’s algorithm module (DESIGN §4.2, §15). Reversal noted (glow IMPL §0c): an earlier version of this paragraph said core “has no notion of levels — that is the wgpu crate’s”. That held while wgpu was the only backend; the glow backend needs the same level policy, so it was hoisted to core to keep the two backends from drifting. Core now owns the level math; only the GPU resources it keys stay backend-specific.

The resolution is exposed as BlurRequest::physical_blur_radius, not a free strength × scale call: a BlurRequest carries two independent scales (source vs target), and the blur convolution happens in the source texture’s pixel space, so the radius must resolve against source_region.scale. Pinning that scale inside the request makes the wrong one impossible to pass (the same guardrail ResolvedMask::from_target gives the corner radius).

Non-negative by construction: a negative radius is meaningless, so Self::new clamps to 0 (which the backend reads as “no blur”), keeping the type total.

Implementations§

Source§

impl BlurStrength

Source

pub fn new(points: f32) -> Self

Construct from logical points. Non-finite input (NaN/±∞) and negatives clamp to 0, so a garbage strength becomes “no blur” rather than a degenerate kernel downstream.

Source

pub fn points(self) -> f32

The blur radius in logical points (always >= 0).

Trait Implementations§

Source§

impl Clone for BlurStrength

Source§

fn clone(&self) -> BlurStrength

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 BlurStrength

Source§

impl Debug for BlurStrength

Source§

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

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

impl PartialEq for BlurStrength

Source§

fn eq(&self, other: &BlurStrength) -> 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 BlurStrength

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