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
impl FlashLimiter
Sourcepub fn new(
device: &Device,
width: u32,
height: u32,
) -> Result<Self, RenderError>
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.
Sourcepub fn shown_texture(&self) -> &Texture
pub fn shown_texture(&self) -> &Texture
The texture of the last limited frame (FLASH_STATE_FORMAT), e.g. for read-back.
Sourcepub fn apply(
&mut self,
encoder: &mut CommandEncoder,
src: &TextureView,
max_step: f32,
) -> &TextureView
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.