Skip to main content

FlashLimiter

Struct FlashLimiter 

Source
pub struct FlashLimiter { /* private fields */ }
Expand description

Limits the per-channel change between the frames it is fed. Owns two FLASH_STATE_FORMAT images of one size (the shown frame and the next); nothing is allocated before FlashLimiter::new.

crate::Renderer::set_flash_limit drives one internally for render_frame. A host that composites frames itself (preset transitions) feeds its final image to FlashLimiter::apply and presents the returned view.

Implementations§

Source§

impl FlashLimiter

Source

pub fn new( device: &Device, width: u32, height: u32, ) -> Result<Self, RenderError>

A limiter for images of width x height; the first frame fades in from black.

Fails with RenderError::Invalid if the size is zero or beyond the device’s texture limit.

Source

pub fn size(&self) -> (u32, u32)

The image size this limiter was made for.

Source

pub fn reset(&mut self)

Forget the shown frame: the next one fades in from black again.

Source

pub fn shown_texture(&self) -> &Texture

The texture of the last limited frame (FLASH_STATE_FORMAT), e.g. for read-back.

Source

pub fn apply( &mut self, encoder: &mut CommandEncoder, src: &TextureView, max_step: f32, ) -> &TextureView

Record the limiting of src (any float-filterable or unfilterable colour image of this limiter’s size) into encoder: each channel of the shown frame moves towards src by at most max_step (in units of the full 0..1 range). max_step is limit * dt; a non-finite or negative value freezes the image. Returns the view of the limited frame, which stays the shown frame for the next call.

Auto Trait Implementations§

§

impl !RefUnwindSafe for FlashLimiter

§

impl !Send for FlashLimiter

§

impl !Sync for FlashLimiter

§

impl !UnwindSafe for FlashLimiter

§

impl Forget for FlashLimiter

§

impl Freeze for FlashLimiter
where PhantomData<*mut u8>: Freeze, PhantomData<(JsValue,)>: Freeze, NonZero<u64>: Freeze, *const RcInner<Cell<u32>> is !null: Freeze, PhantomData<RcInner<Cell<u32>>>: Freeze, *const RcInner<RefCell<Option<Function>>> is !null: Freeze, PhantomData<RcInner<RefCell<Option<Function>>>>: Freeze, *const RcInner<CachedProperties> is !null: Freeze, PhantomData<RcInner<CachedProperties>>: Freeze, *const ArcInner<Mutex<RawMutex, HashSet<WeakMapContext>>> is !null: Freeze, PhantomData<ArcInner<Mutex<RawMutex, HashSet<WeakMapContext>>>>: Freeze, *const RcInner<DropGuard> is !null: Freeze, PhantomData<RcInner<DropGuard>>: Freeze, &'static str: Freeze, InternalBitFlags: Freeze, &'static [TextureFormat]: Freeze,

§

impl Move for FlashLimiter

§

impl Unpin for FlashLimiter
where *mut u8: Unpin, NonZero<u64>: Unpin, Rc<Cell<u32>>: Unpin, Rc<RefCell<Option<Function>>>: Unpin, Rc<CachedProperties>: Unpin, Arc<Mutex<RawMutex, HashSet<WeakMapContext>>>: Unpin, Rc<DropGuard>: Unpin, &'static str: Unpin, InternalBitFlags: Unpin, &'static [TextureFormat]: Unpin,

§

impl UnsafeUnpin for FlashLimiter
where PhantomData<*mut u8>: UnsafeUnpin, PhantomData<(JsValue,)>: UnsafeUnpin, NonZeroU64Inner: UnsafeUnpin, *const RcInner<Cell<u32>> is !null: UnsafeUnpin, PhantomData<RcInner<Cell<u32>>>: UnsafeUnpin, *const RcInner<RefCell<Option<Function>>> is !null: UnsafeUnpin, PhantomData<RcInner<RefCell<Option<Function>>>>: UnsafeUnpin, *const RcInner<CachedProperties> is !null: UnsafeUnpin, PhantomData<RcInner<CachedProperties>>: UnsafeUnpin, *const ArcInner<Mutex<RawMutex, HashSet<WeakMapContext>>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<RawMutex, HashSet<WeakMapContext>>>>: UnsafeUnpin, *const RcInner<DropGuard> is !null: UnsafeUnpin, PhantomData<RcInner<DropGuard>>: UnsafeUnpin, &'static str: UnsafeUnpin, InternalBitFlags: UnsafeUnpin, &'static [TextureFormat]: UnsafeUnpin,

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> 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, 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<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<T> WasmNotSend for T

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T