Struct Refraction
pub struct Refraction {
pub strength: f64,
pub band: f64,
pub radius: f64,
pub dispersion: f64,
}Expand description
How a region’s backdrop is bent, in the pixels of the space it is
recorded or drawn in: a convex lens along the rim of a rounded rect.
Within band of the outline each pixel shows what lies below a point
moved toward the inside along the outline’s normal, by strength at
the outline easing quadratically to none at the band’s inner side; the
rest shows what lies below straight. The backdrop pass evaluates it
together with the blur (Self::displacement is the same arithmetic),
so a bent surface costs no more to draw than a blurred one and a
settled one draws nothing new.
Fields§
§strength: f64Displacement at the outline.
band: f64Width of the band along the outline the displacement eases across.
radius: f64Corner radius of the rounded rect the region is.
dispersion: f64Red and blue set apart by this fraction of the displacement (blue
bent further, as glass bends it); 0 none.
Implementations§
§impl Refraction
impl Refraction
pub const NONE: Refraction
pub const NONE: Refraction
No bend: the backdrop shows straight.
pub fn of(lens: Lens, radius: f64) -> Refraction
pub fn of(lens: Lens, radius: f64) -> Refraction
The bend lens asks for over a body of radius, in its logical
pixels. A lens that states no band eases across two and a half
times its displacement.
pub fn shows_through(&self) -> bool
pub fn shows_through(&self) -> bool
Whether the lens asks for what lies below even unblurred: it bends, or it states a band, as a Liquid lens at no strength does (clear glass, never its opaque fallback). A lens stating neither leaves an unblurred surface its fallback, as before lenses had bands.
pub fn scaled(self, scale: f64) -> Refraction
pub fn scaled(self, scale: f64) -> Refraction
This bend in a space scale pixels per pixel of its own.
pub fn displacement(&self, point: Point, size: Size) -> Vec2
pub fn displacement(&self, point: Point, size: Size) -> Vec2
Where the backdrop a pixel at point of a region of size shows
lies, relative to it: toward the region’s inside along its rounded
outline’s normal, by strength at the outline, easing to nothing
band in (the band held to half the region’s shorter side, so the
two sides of a bar never cross). The backdrop pass’s bend computes
the same.
Trait Implementations§
§impl Clone for Refraction
impl Clone for Refraction
§fn clone(&self) -> Refraction
fn clone(&self) -> Refraction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for Refraction
impl Debug for Refraction
§impl Default for Refraction
impl Default for Refraction
§fn default() -> Refraction
fn default() -> Refraction
§impl PartialEq for Refraction
impl PartialEq for Refraction
impl Copy for Refraction
impl StructuralPartialEq for Refraction
Auto Trait Implementations§
impl Freeze for Refraction
impl RefUnwindSafe for Refraction
impl Send for Refraction
impl Sync for Refraction
impl Unpin for Refraction
impl UnsafeUnpin for Refraction
impl UnwindSafe for Refraction
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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