Lines Matching defs:mask
48 //! - User can specify mask pattern manually, otherwise library will automatically evaluate all 8 masks and select the optimal one
142 /// version. The mask number is either between 0 to 7 (inclusive) to force that
143 /// mask, or `None` to automatically choose an appropriate mask (which may be slow).
165 minversion: Version, maxversion: Version, mask: Option<Mask>, boostecl: bool) -> Result<QrCode<'a>,DataTooLong> {
173 return Ok(Self::encode_codewords(outbuffer, datacodewordslen, tempbuffer, ecl, version, mask));
188 Ok(Self::encode_codewords(outbuffer, datacodewordslen, tempbuffer, ecl, version, mask))
199 /// version. The mask number is either between 0 to 7 (inclusive) to force that
200 /// mask, or `None` to automatically choose an appropriate mask (which may be slow).
221 minversion: Version, maxversion: Version, mask: Option<Mask>, boostecl: bool) -> Result<QrCode<'a>,DataTooLong> {
232 Ok(Self::encode_codewords(outbuffer, datacodewordslen, dataandtempbuffer, ecl, version, mask))
244 /// version. The mask number is either between 0 to 7 (inclusive) to force that
245 /// mask, or `None` to automatically choose an appropriate mask (which may be slow).
315 /// error correction level, data codeword bytes, and mask number.
338 if msk.is_none() { // Automatically choose best mask
349 result.apply_mask(&funcmods, i); // Undoes the mask due to XOR
353 result.apply_mask(&funcmods, msk); // Apply the final choice of mask
383 /// Returns this QR Code's mask, in the range [0, 7].
384 pub fn mask(&self) -> Mask {
593 // on the given mask and error correction level. This always draws all modules of
595 fn draw_format_bits(&mut self, ecl: QrCodeEcc, mask: Mask) {
598 // errcorrlvl is uint2, mask is uint3
599 let data = u32::from(ecl.format_bits() << 3 | mask.value());
675 // XORs the codeword modules in this QR Code with the given mask pattern
678 // the same mask value a second time will undo the mask. A final well-formed
679 // QR Code needs exactly one (not zero, two, etc.) mask applied.
680 fn apply_mask(&mut self, functionmodules: &QrCode, mask: Mask) {
689 match mask.value() {
709 // This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
989 // For use in get_penalty_score(), when evaluating which mask is best.
1458 /// Creates a mask object from the given number.
1461 pub fn new(mask: u8) -> Self {
1462 assert!(mask <= 7, "Mask value out of range");
1463 Self(mask)