pub fn next_frame(&mut self, buf: &mut [u8]) -> Result<(), DecodingError> {
        // TODO 16 bit
        let (color_type, bit_depth) = self.output_color_type();
        let width = get_info!(self).width;
        if buf.len() < self.output_buffer_size() {
            return Err(DecodingError::Other(
                "supplied buffer is too small to hold the image".into(),
            ));
        }
        if get_info!(self).interlaced {
            while let Some((row, adam7)) = self.next_interlaced_row()? {
                let (pass, line, _) = adam7.unwrap();
                let samples = color_type.samples() as u8;
                utils::expand_pass(buf, width, row, pass, line, samples * (bit_depth as u8));
            }
        } else {
            let mut len = 0;
            while let Some(row) = self.next_row()? {
                len += (&mut buf[len..]).write(row)?;
            }
        }
        self.decoder.finished_decoding()
    }
/// Decodes the next frame into `buf`
Decodes the next frame into `buf`
Decodes the next frame into ` buf `
pub fn next_frame(&mut self, buf: &mut [u8]) -> Result<(), DecodingError> {
        // TODO 16 bit
        let (color_type, bit_depth) = self.output_color_type();
        let width = get_info!(self).width;
        if buf.len() < self.output_buffer_size() {
            return Err(DecodingError::Other(
                "supplied buffer is too small to hold the image".into(),
            ));
        }
        if get_info!(self).interlaced {
            while let Some((row, adam7)) = self.next_interlaced_row()? {
                let (pass, line, _) = adam7.unwrap();
                let samples = color_type.samples() as u8;
                utils::expand_pass(buf, width, row, pass, line, samples * (bit_depth as u8));
            }
        } else {
            let mut len = 0;
            while let Some(row) = self.next_row()? {
                len += (&mut buf[len..]).write(row)?;
            }
        }
        self.decoder.finished_decoding()
    }
pub fn next_frame ( & mut self , buf : & mut [ u8 ] ) -> Result < ( ) , DecodingError > { // TODO 16 bit let ( color_type , bit_depth ) = self . output_color_type ( ) ; let width = get_info ! ( self ) . width ; if buf . len ( ) < self . output_buffer_size ( ) { return Err ( DecodingError :: Other ( " " . into ( ) , ) ) ; } if get_info ! ( self ) . interlaced { while let Some ( ( row , adam7 ) ) = self . next_interlaced_row ( ) ? { let ( pass , line , _ ) = adam7 . unwrap ( ) ; let samples = color_type . samples ( ) as u8 ; utils :: expand_pass ( buf , width , row , pass , line , samples * ( bit_depth as u8 ) ) ; } } else { let mut len = 0 ; while let Some ( row ) = self . next_row ( ) ? { len += ( & mut buf [ len .. ] ) . write ( row ) ? ; } } self . decoder . finished_decoding ( ) }
Decodes the next frame into `buf`
Decodes the next frame into ` buf `
&mut self
buf
&mut [u8]
&mut self
buf
&mut [u8]