pub struct AnimatedEncoder { /* private fields */ }Expand description
Configures and runs APNG encoding.
use pltrs_codec::png::{AnimatedEncoder, Frame, ImageRef};
let black = vec![0u8; 4 * 4 * 4];
let white = vec![255u8; 4 * 4 * 4];
let frames = [
Frame { image: ImageRef::rgba8(4, 4, &black)?, delay: (1, 10) },
Frame { image: ImageRef::rgba8(4, 4, &white)?, delay: (1, 10) },
];
let apng = AnimatedEncoder::new().encode(&frames)?;
assert!(apng.windows(4).any(|w| w == b"acTL"));Implementations§
Source§impl AnimatedEncoder
impl AnimatedEncoder
Sourcepub fn plays(self, plays: u32) -> Self
pub fn plays(self, plays: u32) -> Self
How often the animation plays (0, the default, loops forever).
Sourcepub fn compression(self, level: CompressionLevel) -> Self
pub fn compression(self, level: CompressionLevel) -> Self
Sets the zlib compression level.
Sourcepub fn strategy(self, strategy: Strategy) -> Self
pub fn strategy(self, strategy: Strategy) -> Self
Sets the zlib strategy (Strategy::Filtered by default).
Trait Implementations§
Source§impl Clone for AnimatedEncoder
impl Clone for AnimatedEncoder
Source§impl Debug for AnimatedEncoder
impl Debug for AnimatedEncoder
Source§impl Default for AnimatedEncoder
impl Default for AnimatedEncoder
Source§impl PartialEq for AnimatedEncoder
impl PartialEq for AnimatedEncoder
impl StructuralPartialEq for AnimatedEncoder
Auto Trait Implementations§
impl Forget for AnimatedEncoder
impl Freeze for AnimatedEncoder
impl Move for AnimatedEncoder
impl RefUnwindSafe for AnimatedEncoder
impl Send for AnimatedEncoder
impl Sync for AnimatedEncoder
impl Unpin for AnimatedEncoder
impl UnsafeUnpin for AnimatedEncoder
impl UnwindSafe for AnimatedEncoder
Blanket Implementations§
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
Mutably borrows from an owned value. Read more