fn feed<R: Read>(&mut self, mut rdr: R, pixels: &mut [RgbaPixel]) -> Result<(), Error> {
        let twidth = cmp::min(self.x + 64, self.width) - self.x;
        let theight = cmp::min(self.y + 64, self.height) - self.y;
        let base_offset = self.y * self.width + self.x;
        // each channel is laid out one after the other
        let mut channel = 0;
        while channel < self.channels {
            while self.i < twidth * theight {
                let determinant = rdr.read_u8()? as u32;
                if determinant < 127 { // A short run of identical bytes
                    let run = (determinant + 1) as usize;
                    let v = rdr.read_u8()?;
                    for i in (self.i)..(self.i + run) {
                        let index = base_offset + (i / twidth) * self.width + i % twidth;
                        pixels[index].0[channel] = v;
                    }
                    self.i += run;
                } else if determinant == 127 { // A long run of identical bytes
                    let run = rdr.read_u16::<BigEndian>()? as usize;
                    let v = rdr.read_u8()?;
                    for i in (self.i)..(self.i + run) {
                        let index = base_offset + (i / twidth) * self.width + i % twidth;
                        pixels[index].0[channel] = v;
                    }
                    self.i += run;
                } else if determinant == 128 { // A long run of different bytes
                    let stream_run = rdr.read_u16::<BigEndian>()? as usize;
                    for i in (self.i)..(self.i + stream_run) {
                        let index = base_offset + (i / twidth) * self.width + i % twidth;
                        let v = rdr.read_u8()?;
                        pixels[index].0[channel] = v;
                    }
                    self.i += stream_run;
                } else { // A short run of different bytes
                    let stream_run = (256 - determinant) as usize;
                    for i in (self.i)..(self.i + stream_run) {
                        let index = base_offset + (i / twidth) * self.width + i % twidth;
                        let v = rdr.read_u8()?;
                        pixels[index].0[channel] = v;
                    }
                    self.i += stream_run;
                }
            }

            self.i = 0;
            channel += 1;
        }
        Ok(())
    }
/// Feed the cursor a stream starting at the beginning of an XCF tile structure.
Feed the cursor a stream starting at the beginning of an XCF tile structure.
Feed the cursor a stream starting at the beginning of an XCF tile structure .
fn feed<R: Read>(&mut self, mut rdr: R, pixels: &mut [RgbaPixel]) -> Result<(), Error> {
        let twidth = cmp::min(self.x + 64, self.width) - self.x;
        let theight = cmp::min(self.y + 64, self.height) - self.y;
        let base_offset = self.y * self.width + self.x;
        // each channel is laid out one after the other
        let mut channel = 0;
        while channel < self.channels {
            while self.i < twidth * theight {
                let determinant = rdr.read_u8()? as u32;
                if determinant < 127 { // A short run of identical bytes
                    let run = (determinant + 1) as usize;
                    let v = rdr.read_u8()?;
                    for i in (self.i)..(self.i + run) {
                        let index = base_offset + (i / twidth) * self.width + i % twidth;
                        pixels[index].0[channel] = v;
                    }
                    self.i += run;
                } else if determinant == 127 { // A long run of identical bytes
                    let run = rdr.read_u16::<BigEndian>()? as usize;
                    let v = rdr.read_u8()?;
                    for i in (self.i)..(self.i + run) {
                        let index = base_offset + (i / twidth) * self.width + i % twidth;
                        pixels[index].0[channel] = v;
                    }
                    self.i += run;
                } else if determinant == 128 { // A long run of different bytes
                    let stream_run = rdr.read_u16::<BigEndian>()? as usize;
                    for i in (self.i)..(self.i + stream_run) {
                        let index = base_offset + (i / twidth) * self.width + i % twidth;
                        let v = rdr.read_u8()?;
                        pixels[index].0[channel] = v;
                    }
                    self.i += stream_run;
                } else { // A short run of different bytes
                    let stream_run = (256 - determinant) as usize;
                    for i in (self.i)..(self.i + stream_run) {
                        let index = base_offset + (i / twidth) * self.width + i % twidth;
                        let v = rdr.read_u8()?;
                        pixels[index].0[channel] = v;
                    }
                    self.i += stream_run;
                }
            }
            self.i = 0;
            channel += 1;
        }
        Ok(())
    }
fn feed < R : Read > ( & mut self , mut rdr : R , pixels : & mut [ RgbaPixel ] ) -> Result < ( ) , Error > { let twidth = cmp :: min ( self . x + 64 , self . width ) - self . x ; let theight = cmp :: min ( self . y + 64 , self . height ) - self . y ; let base_offset = self . y * self . width + self . x ; // each channel is laid out one after the other let mut channel = 0 ; while channel < self . channels { while self . i < twidth * theight { let determinant = rdr . read_u8 ( ) ? as u32 ; if determinant < 127 { // A short run of identical bytes let run = ( determinant + 1 ) as usize ; let v = rdr . read_u8 ( ) ? ; for i in ( self . i ) .. ( self . i + run ) { let index = base_offset + ( i / twidth ) * self . width + i % twidth ; pixels [ index ] . 0 [ channel ] = v ; } self . i += run ; } else if determinant == 127 { // A long run of identical bytes let run = rdr . read_u16 :: < BigEndian > ( ) ? as usize ; let v = rdr . read_u8 ( ) ? ; for i in ( self . i ) .. ( self . i + run ) { let index = base_offset + ( i / twidth ) * self . width + i % twidth ; pixels [ index ] . 0 [ channel ] = v ; } self . i += run ; } else if determinant == 128 { // A long run of different bytes let stream_run = rdr . read_u16 :: < BigEndian > ( ) ? as usize ; for i in ( self . i ) .. ( self . i + stream_run ) { let index = base_offset + ( i / twidth ) * self . width + i % twidth ; let v = rdr . read_u8 ( ) ? ; pixels [ index ] . 0 [ channel ] = v ; } self . i += stream_run ; } else { // A short run of different bytes let stream_run = ( 256 - determinant ) as usize ; for i in ( self . i ) .. ( self . i + stream_run ) { let index = base_offset + ( i / twidth ) * self . width + i % twidth ; let v = rdr . read_u8 ( ) ? ; pixels [ index ] . 0 [ channel ] = v ; } self . i += stream_run ; } } self . i = 0 ; channel += 1 ; } Ok ( ( ) ) }
Feed the cursor a stream starting at the beginning of an XCF tile structure.
Feed the cursor a stream starting at the beginning of an XCF tile structure .
&mut self
rdr
R
pixels
&mut [RgbaPixel]
&mut self
rdr
R
pixels
&mut [RgbaPixel]