pub struct PngWriter { /* private fields */ }Expand description
Encodes a Texture into PNG format.
In addition to single-image PNG, the writer can emit an animated PNG (APNG) from a sequence of frames via writeAnimated(). Each frame is written full-canvas with no inter-frame optimisation.
Implementations§
Source§impl PngWriter
impl PngWriter
Sourcepub fn write(&mut self, texture: &Texture) -> Bytes
pub fn write(&mut self, texture: &Texture) -> Bytes
Serialize the texture to a PNG byte buffer.
Sourcepub fn write_animated(
&mut self,
frames: &[&PngApngFrame],
opts: &PngApngSaveOptions,
) -> Bytes
pub fn write_animated( &mut self, frames: &[&PngApngFrame], opts: &PngApngSaveOptions, ) -> Bytes
Serialize a sequence of frames into an animated PNG (APNG) byte buffer.
All frames must share the same dimensions (frame 0 defines the canvas). Each frame is emitted full-canvas with disposal NONE and blend SOURCE. Returns an empty buffer on failure (lenient mode). @param frames Ordered animation frames; must be non-empty. @param opts Encoding options (loop count).
Sourcepub fn has_issues(&self) -> bool
pub fn has_issues(&self) -> bool
@return true if the last write produced any issues.
Trait Implementations§
impl Send for PngWriter
Auto Trait Implementations§
impl !Sync for PngWriter
impl Freeze for PngWriter
impl RefUnwindSafe for PngWriter
impl Unpin for PngWriter
impl UnsafeUnpin for PngWriter
impl UnwindSafe for PngWriter
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