fn draw_codewords(&mut self, data: &[u8]) {
        assert_eq!(
            data.len(),
            QrCode::get_num_raw_data_modules(self.version) / 8,
            "Illegal argument"
        );

        let mut i: usize = 0; // Bit index into the data
                              // Do the funny zigzag scan
        let mut right: i32 = self.size - 1;
        while right >= 1 {
            // Index of right column in each column pair
            if right == 6 {
                right = 5;
            }
            for vert in 0..self.size {
                // Vertical counter
                for j in 0..2 {
                    let x: i32 = right - j; // Actual x coordinate
                    let upward: bool = (right + 1) & 2 == 0;
                    let y: i32 = if upward { self.size - 1 - vert } else { vert }; // Actual y coordinate
                    if !self.isfunction[(y * self.size + x) as usize] && i < data.len() * 8 {
                        *self.module_mut(x, y) =
                            get_bit(u32::from(data[i >> 3]), 7 - ((i as i32) & 7));
                        i += 1;
                    }
                    // If this QR Code has any remainder bits (0 to 7), they were assigned as
                    // 0/false/light by the constructor and are left unchanged by this method
                }
            }
            right -= 2;
        }
        debug_assert_eq!(i, data.len() * 8);
    }
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
// data area of this QR Code. Function modules need to be marked off before this is called.
Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
data area of this QR Code. Function modules need to be marked off before this is called.
Draws the given sequence of 8 - bit codewords ( data and error correction ) onto the entire data area of this QR Code . Function modules need to be marked off before this is called .
fn draw_codewords(&mut self, data: &[u8]) {
        assert_eq!(
            data.len(),
            QrCode::get_num_raw_data_modules(self.version) / 8,
            "Illegal argument"
        );
        let mut i: usize = 0; // Bit index into the data
                              // Do the funny zigzag scan
        let mut right: i32 = self.size - 1;
        while right >= 1 {
            // Index of right column in each column pair
            if right == 6 {
                right = 5;
            }
            for vert in 0..self.size {
                // Vertical counter
                for j in 0..2 {
                    let x: i32 = right - j; // Actual x coordinate
                    let upward: bool = (right + 1) & 2 == 0;
                    let y: i32 = if upward { self.size - 1 - vert } else { vert }; // Actual y coordinate
                    if !self.isfunction[(y * self.size + x) as usize] && i < data.len() * 8 {
                        *self.module_mut(x, y) =
                            get_bit(u32::from(data[i >> 3]), 7 - ((i as i32) & 7));
                        i += 1;
                    }
                    // If this QR Code has any remainder bits (0 to 7), they were assigned as
                    // 0/false/light by the constructor and are left unchanged by this method
                }
            }
            right -= 2;
        }
        debug_assert_eq!(i, data.len() * 8);
    }
fn draw_codewords ( & mut self , data : & [ u8 ] ) { assert_eq ! ( data len ( ) QrCode get_num_raw_data_modules ( self version ) 8 " " ) ; let mut i : usize = 0 ; // Bit index into the data // Do the funny zigzag scan let mut right : i32 = self . size - 1 ; while right >= 1 { // Index of right column in each column pair if right == 6 { right = 5 ; } for vert in 0 .. self . size { // Vertical counter for j in 0 .. 2 { let x : i32 = right - j ; // Actual x coordinate let upward : bool = ( right + 1 ) & 2 == 0 ; let y : i32 = if upward { self . size - 1 - vert } else { vert } ; // Actual y coordinate if ! self . isfunction [ ( y * self . size + x ) as usize ] && i < data . len ( ) * 8 { * self . module_mut ( x , y ) = get_bit ( u32 :: from ( data [ i >> 3 ] ) , 7 - ( ( i as i32 ) & 7 ) ) ; i += 1 ; } // If this QR Code has any remainder bits (0 to 7), they were assigned as // 0/false/light by the constructor and are left unchanged by this method } } right -= 2 ; } debug_assert_eq ! ( i data len ( ) 8 ) ; }
Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
data area of this QR Code.
Draws the given sequence of 8 - bit codewords ( data and error correction ) onto the entire data area of this QR Code .
&mut self
data
&[u8]