Lines Matching defs:mask
48 //! - User can specify mask pattern manually, otherwise library will automatically evaluate all 8 masks and select the optimal one
129 // The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).
130 // Even if a QR Code is created with automatic masking requested (mask = None),
131 // the resulting object still has a mask value between 0 and 7.
132 mask: Mask,
202 /// version. The mask number is either between 0 to 7 (inclusive) to force that
203 /// mask, or `None` to automatically choose an appropriate mask (which may be slow).
212 minversion: Version, maxversion: Version, mask: Option<Mask>, boostecl: bool)
274 Ok(QrCode::encode_codewords(version, ecl, &datacodewords, mask))
281 /// error correction level, data codeword bytes, and mask number.
291 mask: Mask::new(0), // Dummy value
303 if msk.is_none() { // Automatically choose best mask
314 result.apply_mask(i); // Undoes the mask due to XOR
318 result.mask = msk;
319 result.apply_mask(msk); // Apply the final choice of mask
348 /// Returns this QR Code's mask, in the range [0, 7].
349 pub fn mask(&self) -> Mask {
350 self.mask
405 self.draw_format_bits(Mask::new(0)); // Dummy mask value; overwritten later in the constructor
411 // based on the given mask and this object's error correction level field.
412 fn draw_format_bits(&mut self, mask: Mask) {
415 // errcorrlvl is uint2, mask is uint3
416 let data: u32 = u32::from(self.errorcorrectionlevel.format_bits() << 3 | mask.value());
589 // XORs the codeword modules in this QR Code with the given mask pattern.
592 // the same mask value a second time will undo the mask. A final well-formed
593 // QR Code needs exactly one (not zero, two, etc.) mask applied.
594 fn apply_mask(&mut self, mask: Mask) {
597 let invert: bool = match mask.value() {
615 // This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
863 // For use in get_penalty_score(), when evaluating which mask is best.
1284 /// Creates a mask object from the given number.
1287 pub fn new(mask: u8) -> Self {
1288 assert!(mask <= 7, "Mask value out of range");
1289 Self(mask)