pub fn write_to_buffer(&self, fetcher: &mut Fetcher)  {
        fetcher.buffer.resize(self.width * self.height * 2, 0);

        for y in 0..self.height {
            for x in 0..self.width {
                let idx = y * self.width + x;
                let pixel = &self.data[idx];
                let c_u8 = U8Vec3::new(
                    (pixel.color[0] * 255.0) as u8, // rust will auto clamp
                    (pixel.color[1] * 255.0) as u8,
                    (pixel.color[2] * 255.0) as u8,
                );

                fetcher.buffer[idx * 2] = pixel.ch as u32;
                fetcher.buffer[idx * 2 + 1] = 0xff << 24 + c_u8[0] << 16 + c_u8[1] << 8 + c_u8[2];
            }
        }
    }
// in case wasm wants the buffer
in case wasm wants the buffer
in case wasm wants the buffer
pub fn write_to_buffer(&self, fetcher: &mut Fetcher)  {
        fetcher.buffer.resize(self.width * self.height * 2, 0);
        for y in 0..self.height {
            for x in 0..self.width {
                let idx = y * self.width + x;
                let pixel = &self.data[idx];
                let c_u8 = U8Vec3::new(
                    (pixel.color[0] * 255.0) as u8, // rust will auto clamp
                    (pixel.color[1] * 255.0) as u8,
                    (pixel.color[2] * 255.0) as u8,
                );
                fetcher.buffer[idx * 2] = pixel.ch as u32;
                fetcher.buffer[idx * 2 + 1] = 0xff << 24 + c_u8[0] << 16 + c_u8[1] << 8 + c_u8[2];
            }
        }
    }
pub fn write_to_buffer ( & self , fetcher : & mut Fetcher ) { fetcher . buffer . resize ( self . width * self . height * 2 , 0 ) ; for y in 0 .. self . height { for x in 0 .. self . width { let idx = y * self . width + x ; let pixel = & self . data [ idx ] ; let c_u8 = U8Vec3 :: new ( ( pixel . color [ 0 ] * 255.0 ) as u8 , // rust will auto clamp ( pixel . color [ 1 ] * 255.0 ) as u8 , ( pixel . color [ 2 ] * 255.0 ) as u8 , ) ; fetcher . buffer [ idx * 2 ] = pixel . ch as u32 ; fetcher . buffer [ idx * 2 + 1 ] = 0xff << 24 + c_u8 [ 0 ] << 16 + c_u8 [ 1 ] << 8 + c_u8 [ 2 ] ; } } }
in case wasm wants the buffer
in case wasm wants the buffer
&self
fetcher
&mut Fetcher
&self
fetcher
&mut Fetcher