multi-decode helpers use MultiUseMultiFormatReader

This commit is contained in:
Henry Schimke
2023-03-06 11:38:06 -06:00
parent bef21af81e
commit 284067f582

View File

@@ -8,7 +8,7 @@ use crate::{
common::{BitMatrix, HybridBinarizer, Result}, common::{BitMatrix, HybridBinarizer, Result},
multi::{GenericMultipleBarcodeReader, MultipleBarcodeReader}, multi::{GenericMultipleBarcodeReader, MultipleBarcodeReader},
BarcodeFormat, BinaryBitmap, DecodeHintType, DecodeHintValue, DecodingHintDictionary, BarcodeFormat, BinaryBitmap, DecodeHintType, DecodeHintValue, DecodingHintDictionary,
Exceptions, Luma8LuminanceSource, MultiFormatReader, RXingResult, Reader, Exceptions, Luma8LuminanceSource, MultiFormatReader, RXingResult, Reader, MultiUseMultiFormatReader,
}; };
#[cfg(feature = "image")] #[cfg(feature = "image")]
@@ -74,7 +74,7 @@ pub fn detect_multiple_in_svg_with_hints(
) -> Result<Vec<RXingResult>> { ) -> Result<Vec<RXingResult>> {
use std::{fs::File, io::Read}; use std::{fs::File, io::Read};
use crate::SVGLuminanceSource; use crate::{SVGLuminanceSource};
let path = PathBuf::from(file_name); let path = PathBuf::from(file_name);
if !path.exists() { if !path.exists() {
@@ -90,7 +90,7 @@ pub fn detect_multiple_in_svg_with_hints(
return Err(Exceptions::illegal_argument_with("file cannot be read")); return Err(Exceptions::illegal_argument_with("file cannot be read"));
} }
let multi_format_reader = MultiFormatReader::default(); let multi_format_reader = MultiUseMultiFormatReader::default();
let mut scanner = GenericMultipleBarcodeReader::new(multi_format_reader); let mut scanner = GenericMultipleBarcodeReader::new(multi_format_reader);
hints hints
@@ -148,7 +148,7 @@ pub fn detect_multiple_in_file_with_hints(
) -> Result<Vec<RXingResult>> { ) -> Result<Vec<RXingResult>> {
let img = image::open(file_name) let img = image::open(file_name)
.map_err(|e| Exceptions::runtime_with(format!("couldn't read {file_name}: {e}")))?; .map_err(|e| Exceptions::runtime_with(format!("couldn't read {file_name}: {e}")))?;
let multi_format_reader = MultiFormatReader::default(); let multi_format_reader = MultiUseMultiFormatReader::default();
let mut scanner = GenericMultipleBarcodeReader::new(multi_format_reader); let mut scanner = GenericMultipleBarcodeReader::new(multi_format_reader);
hints hints
@@ -208,7 +208,7 @@ pub fn detect_multiple_in_luma_with_hints(
height: u32, height: u32,
hints: &mut DecodingHintDictionary, hints: &mut DecodingHintDictionary,
) -> Result<Vec<RXingResult>> { ) -> Result<Vec<RXingResult>> {
let multi_format_reader = MultiFormatReader::default(); let multi_format_reader = MultiUseMultiFormatReader::default();
let mut scanner = GenericMultipleBarcodeReader::new(multi_format_reader); let mut scanner = GenericMultipleBarcodeReader::new(multi_format_reader);
hints hints