Skip to main content

ImageCodec

Trait ImageCodec 

Source
pub trait ImageCodec {
    // Required methods
    fn frame_count(&self) -> u32;
    fn repetition(&self) -> ImageRepetition;
    fn next_frame(&mut self) -> ImageFrameFuture<'_>;
}
Expand description

One encoded image, opened and ready to give up its frames. Flutter dart:ui Codec.

A still image is a codec with one frame, so a caller never has to know in advance which it has. Dropping the codec is what tells the host the image is no longer wanted.

Required Methods§

Source

fn frame_count(&self) -> u32

How many frames the file holds; one for a still image.

Source

fn repetition(&self) -> ImageRepetition

What happens when the last frame has been shown.

Source

fn next_frame(&mut self) -> ImageFrameFuture<'_>

The next frame, wrapping back to the first after the last, as Dart’s does.

A caller that waits for a frame holds the codec while it does, so nothing can ask the same codec for two frames at once.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§