mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 12:52:34 +00:00
add point(x: f32, y: f32) function
Shorter than writing `Point::new`
This commit is contained in:
@@ -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,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user