Struct png::StreamingDecoder
source · pub struct StreamingDecoder { /* private fields */ }
Expand description
PNG StreamingDecoder (low-level interface)
By default, the decoder does not verify Adler-32 checksum computation. To
enable checksum verification, set it with StreamingDecoder::set_ignore_adler32
before starting decompression.
Implementations§
source§impl StreamingDecoder
impl StreamingDecoder
sourcepub fn new() -> StreamingDecoder
pub fn new() -> StreamingDecoder
Creates a new StreamingDecoder
Allocates the internal buffers.
pub fn new_with_options(decode_options: DecodeOptions) -> StreamingDecoder
pub fn set_ignore_text_chunk(&mut self, ignore_text_chunk: bool)
sourcepub fn ignore_adler32(&self) -> bool
pub fn ignore_adler32(&self) -> bool
Return whether the decoder is set to ignore the Adler-32 checksum.
sourcepub fn set_ignore_adler32(&mut self, ignore_adler32: bool) -> bool
pub fn set_ignore_adler32(&mut self, ignore_adler32: bool) -> bool
Set whether to compute and verify the Adler-32 checksum during
decompression. Return true
if the flag was successfully set.
The decoder defaults to true
.
This flag cannot be modified after decompression has started until the
StreamingDecoder
is reset.
sourcepub fn set_ignore_crc(&mut self, ignore_crc: bool)
pub fn set_ignore_crc(&mut self, ignore_crc: bool)
Set whether to compute and verify the Adler-32 checksum during
decompression. Return true
if the flag was successfully set.
The decoder defaults to false
.
sourcepub fn update(
&mut self,
buf: &[u8],
image_data: &mut Vec<u8>
) -> Result<(usize, Decoded), DecodingError>
pub fn update( &mut self, buf: &[u8], image_data: &mut Vec<u8> ) -> Result<(usize, Decoded), DecodingError>
Low level StreamingDecoder interface.
Allows to stream partial data to the encoder. Returns a tuple containing the bytes that have
been consumed from the input buffer and the current decoding result. If the decoded chunk
was an image data chunk, it also appends the read data to image_data
.