swap point_f and point functions

This commit is contained in:
Henry Schimke
2023-05-04 14:50:32 -05:00
parent 80f06ecb3c
commit 3fc068f49b
38 changed files with 210 additions and 217 deletions

View File

@@ -20,7 +20,7 @@ use crate::common::{BitArray, Result};
use crate::DecodeHintValue;
use crate::Exceptions;
use crate::RXingResult;
use crate::{point, BarcodeFormat};
use crate::{point_f, BarcodeFormat};
use super::OneDReader;
@@ -171,8 +171,8 @@ impl OneDReader for CodaBarReader {
&self.decodeRowRXingResult,
Vec::new(),
vec![
point(left, rowNumber as f32),
point(right, rowNumber as f32),
point_f(left, rowNumber as f32),
point_f(right, rowNumber as f32),
],
BarcodeFormat::CODABAR,
);

View File

@@ -18,7 +18,7 @@ use rxing_one_d_proc_derive::OneDReader;
use crate::{
common::{BitArray, Result},
point, BarcodeFormat, Exceptions, RXingResult,
point_f, BarcodeFormat, Exceptions, RXingResult,
};
use super::{one_d_reader, OneDReader};
@@ -338,8 +338,8 @@ impl OneDReader for Code128Reader {
&result,
rawBytes,
vec![
point(left, rowNumber as f32),
point(right, rowNumber as f32),
point_f(left, rowNumber as f32),
point_f(right, rowNumber as f32),
],
BarcodeFormat::CODE_128,
);

View File

@@ -17,7 +17,7 @@
use rxing_one_d_proc_derive::OneDReader;
use crate::common::{BitArray, Result};
use crate::{point, BarcodeFormat, Exceptions, RXingResult};
use crate::{point_f, BarcodeFormat, Exceptions, RXingResult};
use super::{one_d_reader, OneDReader};
@@ -134,8 +134,8 @@ impl OneDReader for Code39Reader {
&resultString,
Vec::new(),
vec![
point(left, rowNumber as f32),
point(right, rowNumber as f32),
point_f(left, rowNumber as f32),
point_f(right, rowNumber as f32),
],
BarcodeFormat::CODE_39,
);

View File

@@ -18,7 +18,7 @@ use rxing_one_d_proc_derive::OneDReader;
use crate::{
common::{BitArray, Result},
point, BarcodeFormat, Exceptions, RXingResult,
point_f, BarcodeFormat, Exceptions, RXingResult,
};
use super::{one_d_reader, OneDReader};
@@ -117,8 +117,8 @@ impl OneDReader for Code93Reader {
&resultString,
Vec::new(),
vec![
point(left, rowNumber as f32),
point(right, rowNumber as f32),
point_f(left, rowNumber as f32),
point_f(right, rowNumber as f32),
],
BarcodeFormat::CODE_93,
);

View File

@@ -18,7 +18,7 @@ use rxing_one_d_proc_derive::OneDReader;
use crate::{
common::{BitArray, Result},
point, BarcodeFormat, DecodeHintValue, Exceptions, RXingResult,
point_f, BarcodeFormat, DecodeHintValue, Exceptions, RXingResult,
};
use super::{one_d_reader, OneDReader};
@@ -150,8 +150,8 @@ impl OneDReader for ITFReader {
&resultString,
Vec::new(), // no natural byte representation for these barcodes
vec![
point(startRange[1] as f32, rowNumber as f32),
point(endRange[0] as f32, rowNumber as f32),
point_f(startRange[1] as f32, rowNumber as f32),
point_f(endRange[0] as f32, rowNumber as f32),
],
BarcodeFormat::ITF,
);

View File

@@ -16,7 +16,7 @@
use crate::{
common::{BitArray, Result},
point, Binarizer, BinaryBitmap, DecodeHintType, DecodeHintValue, DecodingHintDictionary,
point_f, Binarizer, BinaryBitmap, DecodeHintType, DecodeHintValue, DecodingHintDictionary,
Exceptions, RXingResult, RXingResultMetadataType, RXingResultMetadataValue, Reader,
};
@@ -117,8 +117,8 @@ pub trait OneDReader: Reader {
// And remember to flip the result points horizontally.
let points = result.getPointsMut();
if !points.is_empty() && points.len() >= 2 {
points[0] = point(width as f32 - points[0].x - 1.0, points[0].y);
points[1] = point(width as f32 - points[1].x - 1.0, points[1].y);
points[0] = point_f(width as f32 - points[0].x - 1.0, points[0].y);
points[1] = point_f(width as f32 - points[1].x - 1.0, points[1].y);
}
}
return Ok(result);

View File

@@ -16,7 +16,7 @@
use std::hash::Hash;
use crate::{point, Point};
use crate::{point_f, Point};
/**
* Encapsulates an RSS barcode finder pattern, including its start/end position and row.
@@ -34,8 +34,8 @@ impl FinderPattern {
value,
startEnd,
resultPoints: vec![
point(start as f32, rowNumber as f32),
point(end as f32, rowNumber as f32),
point_f(start as f32, rowNumber as f32),
point_f(end as f32, rowNumber as f32),
],
}
}

View File

@@ -19,7 +19,7 @@ use std::collections::HashMap;
use crate::{
common::{BitArray, Result},
oned::{one_d_reader, OneDReader},
point, BarcodeFormat, Binarizer, DecodeHintType, DecodeHintValue, DecodingHintDictionary,
point_f, BarcodeFormat, Binarizer, DecodeHintType, DecodeHintValue, DecodingHintDictionary,
Exceptions, RXingResult, RXingResultMetadataType, RXingResultMetadataValue, Reader,
};
@@ -259,7 +259,7 @@ impl RSS14Reader {
// row is actually reversed
center = row.get_size() as f32 - 1.0 - center;
}
cb(point(center, rowNumber as f32));
cb(point_f(center, rowNumber as f32));
}
let outside = self.decodeDataCharacter(row, &pattern, true)?;

View File

@@ -18,7 +18,7 @@ use std::collections::HashMap;
use crate::{
common::{BitArray, Result},
point, BarcodeFormat, Exceptions, RXingResult, RXingResultMetadataType,
point_f, BarcodeFormat, Exceptions, RXingResult, RXingResultMetadataType,
RXingResultMetadataValue,
};
@@ -49,11 +49,11 @@ impl UPCEANExtension2Support {
&resultString,
Vec::new(),
vec![
point(
point_f(
(extensionStartRange[0] + extensionStartRange[1]) as f32 / 2.0,
rowNumber as f32,
),
point(end as f32, rowNumber as f32),
point_f(end as f32, rowNumber as f32),
],
BarcodeFormat::UPC_EAN_EXTENSION,
);

View File

@@ -18,7 +18,7 @@ use std::collections::HashMap;
use crate::{
common::{BitArray, Result},
point, BarcodeFormat, Exceptions, RXingResult, RXingResultMetadataType,
point_f, BarcodeFormat, Exceptions, RXingResult, RXingResultMetadataType,
RXingResultMetadataValue,
};
@@ -51,11 +51,11 @@ impl UPCEANExtension5Support {
&resultString,
Vec::new(),
vec![
point(
point_f(
(extensionStartRange[0] + extensionStartRange[1]) as f32 / 2.0,
rowNumber as f32,
),
point(end as f32, rowNumber as f32),
point_f(end as f32, rowNumber as f32),
],
BarcodeFormat::UPC_EAN_EXTENSION,
);

View File

@@ -16,7 +16,7 @@
use crate::{
common::{BitArray, Result},
point, BarcodeFormat, Binarizer, DecodeHintType, DecodeHintValue, Exceptions, RXingResult,
point_f, BarcodeFormat, Binarizer, DecodeHintType, DecodeHintValue, Exceptions, RXingResult,
RXingResultMetadataType, RXingResultMetadataValue, Reader,
};
@@ -156,7 +156,7 @@ pub trait UPCEANReader: OneDReader {
let mut symbologyIdentifier = 0;
if let Some(DecodeHintValue::NeedResultPointCallback(cb)) = resultPointCallback {
cb(point(
cb(point_f(
(startGuardRange[0] + startGuardRange[1]) as f32 / 2.0,
rowNumber as f32,
));
@@ -166,13 +166,13 @@ pub trait UPCEANReader: OneDReader {
let endStart = self.decodeMiddle(row, startGuardRange, &mut result)?;
if let Some(DecodeHintValue::NeedResultPointCallback(cb)) = resultPointCallback {
cb(point(endStart as f32, rowNumber as f32));
cb(point_f(endStart as f32, rowNumber as f32));
}
let endRange = self.decodeEnd(row, endStart)?;
if let Some(DecodeHintValue::NeedResultPointCallback(cb)) = resultPointCallback {
cb(point(
cb(point_f(
(endRange[0] + endRange[1]) as f32 / 2.0,
rowNumber as f32,
));
@@ -204,8 +204,8 @@ pub trait UPCEANReader: OneDReader {
&resultString,
Vec::new(), // no natural byte representation for these barcodes
vec![
point(left, rowNumber as f32),
point(right, rowNumber as f32),
point_f(left, rowNumber as f32),
point_f(right, rowNumber as f32),
],
format,
);