pub struct PngParser { /* private fields */ }Expand description
Reads a PNG file or byte buffer and decodes it into a Texture.
Animated PNG (APNG) is supported: parse() still returns the single default image, while the animation frames are exposed via isAnimated(), frameCount(), frame(), frameDelayMs() and frameInfo().
Implementations§
Source§impl PngParser
impl PngParser
Sourcepub fn has_issues(&self) -> bool
pub fn has_issues(&self) -> bool
@return true if the last parse produced any issues.
Sourcepub fn is_animated(&self) -> bool
pub fn is_animated(&self) -> bool
@return true if the last parsed PNG carried APNG animation chunks.
Sourcepub fn frame_count(&self) -> u32
pub fn frame_count(&self) -> u32
@return number of animation frames (0 when not animated).
Sourcepub fn loop_count(&self) -> u32
pub fn loop_count(&self) -> u32
@return APNG loop count from the acTL chunk; 0 means loop forever.
Sourcepub fn frame(&self, index: u32) -> Option<Texture>
pub fn frame(&self, index: u32) -> Option<Texture>
@return animation frame @p index, fully composited to the canvas size as an RGBA8 texture. In lenient mode an out-of-range index yields an empty texture; in strict mode it throws. @param index Zero-based frame index.
Sourcepub fn frame_delay_ms(&self, index: u32) -> u32
pub fn frame_delay_ms(&self, index: u32) -> u32
@return display duration of frame @p index in milliseconds. @param index Zero-based frame index.
Sourcepub fn frame_info(&self, index: u32) -> Option<PngApngFrameInfo>
pub fn frame_info(&self, index: u32) -> Option<PngApngFrameInfo>
@return raw per-frame metadata for frame @p index. @param index Zero-based frame index.