diff --git a/src/barcode_format.rs b/src/barcode_format.rs index 3d9b193..bdc9bed 100644 --- a/src/barcode_format.rs +++ b/src/barcode_format.rs @@ -114,18 +114,21 @@ impl From<&str> for BarcodeFormat { "code 39" | "code_39" | "code39" => BarcodeFormat::CODE_39, "code 93" | "code_93" | "code93" => BarcodeFormat::CODE_93, "code 128" | "code_129" | "code128" => BarcodeFormat::CODE_128, - "datamatrix" |"data matrix" | "data_matrix"=> BarcodeFormat::DATA_MATRIX, + "datamatrix" | "data matrix" | "data_matrix" => BarcodeFormat::DATA_MATRIX, "ean 8" | "ean_8" | "ean8" => BarcodeFormat::EAN_8, - "ean 13" |"ean_13" | "ean13"=> BarcodeFormat::EAN_13, - "itf" | "itf_code" | "itf14" | "itf 14" | "itf_14" | "interleaved 2 of 5"=> BarcodeFormat::ITF, - "maxicode" | "maxi_code"=> BarcodeFormat::MAXICODE, - "pdf 417" | "pdf_417" | "pdf417"=> BarcodeFormat::PDF_417, - "qrcode" | "qr_code" | "qr code"=> BarcodeFormat::QR_CODE, + "ean 13" | "ean_13" | "ean13" => BarcodeFormat::EAN_13, + "itf" | "itf_code" | "itf14" | "itf 14" | "itf_14" | "interleaved 2 of 5" => { + BarcodeFormat::ITF + } + "maxicode" | "maxi_code" => BarcodeFormat::MAXICODE, + "pdf 417" | "pdf_417" | "pdf417" => BarcodeFormat::PDF_417, + "qrcode" | "qr_code" | "qr code" => BarcodeFormat::QR_CODE, "rss 14" | "rss_14" | "rss14" | "gs1 databar" => BarcodeFormat::RSS_14, - "rss expanded" | "expanded rss" | "rss_expanded"=> BarcodeFormat::RSS_EXPANDED, - "upc a" |"upc_a" | "upca"=> BarcodeFormat::UPC_A, - "upc e" |"upc_e" | "upce" => BarcodeFormat::UPC_E, - "upc ean extension" | "upc extension" | "ean extension" | "upc/ean extension" | "upc_ean_extension"=> BarcodeFormat::UPC_EAN_EXTENSION, + "rss expanded" | "expanded rss" | "rss_expanded" => BarcodeFormat::RSS_EXPANDED, + "upc a" | "upc_a" | "upca" => BarcodeFormat::UPC_A, + "upc e" | "upc_e" | "upce" => BarcodeFormat::UPC_E, + "upc ean extension" | "upc extension" | "ean extension" | "upc/ean extension" + | "upc_ean_extension" => BarcodeFormat::UPC_EAN_EXTENSION, _ => BarcodeFormat::QR_CODE, } } diff --git a/src/common/bit_matrix.rs b/src/common/bit_matrix.rs index d12721a..346ddbf 100644 --- a/src/common/bit_matrix.rs +++ b/src/common/bit_matrix.rs @@ -674,12 +674,16 @@ impl From for image::DynamicImage { impl From<&BitMatrix> for image::DynamicImage { fn from(value: &BitMatrix) -> Self { let mut pixels = image::ImageBuffer::new(value.width, value.height); - + for y in 0..value.height { for x in 0..value.width { - pixels.put_pixel(x, y, image::Luma([if value.get(x, y) {u8::MIN} else {u8::MAX} ])); + pixels.put_pixel( + x, + y, + image::Luma([if value.get(x, y) { u8::MIN } else { u8::MAX }]), + ); } } pixels.into() } -} \ No newline at end of file +} diff --git a/src/common/reedsolomon/reedsolomon_encoder.rs b/src/common/reedsolomon/reedsolomon_encoder.rs index ee2b7da..f72ed31 100644 --- a/src/common/reedsolomon/reedsolomon_encoder.rs +++ b/src/common/reedsolomon/reedsolomon_encoder.rs @@ -54,8 +54,10 @@ impl ReedSolomonEncoder { .multiply( &GenericGFPoly::new( self.field, - &[1, - self.field.exp(d as i32 - 1 + self.field.getGeneratorBase())], + &[ + 1, + self.field.exp(d as i32 - 1 + self.field.getGeneratorBase()), + ], ) .unwrap(), )