add point(x: f32, y: f32) function

Shorter than writing `Point::new`
This commit is contained in:
Vukašin Stepanović
2023-02-16 11:20:03 +00:00
parent 868a9b26de
commit 39b4866e47
22 changed files with 113 additions and 109 deletions

View File

@@ -16,7 +16,7 @@
use crate::{
common::{BitArray, Result},
BarcodeFormat, DecodeHintType, DecodeHintValue, Exceptions, Point, RXingResult,
point, BarcodeFormat, 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::new(
cb(&point(
(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::new(endStart as f32, rowNumber as f32));
cb(&point(endStart as f32, rowNumber as f32));
}
let endRange = self.decodeEnd(row, endStart)?;
if let Some(DecodeHintValue::NeedResultPointCallback(cb)) = resultPointCallback {
cb(&Point::new(
cb(&point(
(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::new(left, rowNumber as f32),
Point::new(right, rowNumber as f32),
point(left, rowNumber as f32),
point(right, rowNumber as f32),
],
format,
);