mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
wip: Search & replace RXingResultPoint with Point
Build fails because the OneDReader proc macro expects that a RXingResultPoint type exists.
This commit is contained in:
@@ -171,8 +171,8 @@ impl OneDReader for CodaBarReader {
|
||||
&self.decodeRowRXingResult,
|
||||
Vec::new(),
|
||||
vec![
|
||||
RXingResultPoint::new(left, rowNumber as f32),
|
||||
RXingResultPoint::new(right, rowNumber as f32),
|
||||
Point::new(left, rowNumber as f32),
|
||||
Point::new(right, rowNumber as f32),
|
||||
],
|
||||
BarcodeFormat::CODABAR,
|
||||
);
|
||||
|
||||
@@ -342,8 +342,8 @@ impl OneDReader for Code128Reader {
|
||||
&result,
|
||||
rawBytes,
|
||||
vec![
|
||||
RXingResultPoint::new(left, rowNumber as f32),
|
||||
RXingResultPoint::new(right, rowNumber as f32),
|
||||
Point::new(left, rowNumber as f32),
|
||||
Point::new(right, rowNumber as f32),
|
||||
],
|
||||
BarcodeFormat::CODE_128,
|
||||
);
|
||||
|
||||
@@ -134,8 +134,8 @@ impl OneDReader for Code39Reader {
|
||||
&resultString,
|
||||
Vec::new(),
|
||||
vec![
|
||||
RXingResultPoint::new(left, rowNumber as f32),
|
||||
RXingResultPoint::new(right, rowNumber as f32),
|
||||
Point::new(left, rowNumber as f32),
|
||||
Point::new(right, rowNumber as f32),
|
||||
],
|
||||
BarcodeFormat::CODE_39,
|
||||
);
|
||||
|
||||
@@ -117,8 +117,8 @@ impl OneDReader for Code93Reader {
|
||||
&resultString,
|
||||
Vec::new(),
|
||||
vec![
|
||||
RXingResultPoint::new(left, rowNumber as f32),
|
||||
RXingResultPoint::new(right, rowNumber as f32),
|
||||
Point::new(left, rowNumber as f32),
|
||||
Point::new(right, rowNumber as f32),
|
||||
],
|
||||
BarcodeFormat::CODE_93,
|
||||
);
|
||||
|
||||
@@ -150,8 +150,8 @@ impl OneDReader for ITFReader {
|
||||
&resultString,
|
||||
Vec::new(), // no natural byte representation for these barcodes
|
||||
vec![
|
||||
RXingResultPoint::new(startRange[1] as f32, rowNumber as f32),
|
||||
RXingResultPoint::new(endRange[0] as f32, rowNumber as f32),
|
||||
Point::new(startRange[1] as f32, rowNumber as f32),
|
||||
Point::new(endRange[0] as f32, rowNumber as f32),
|
||||
],
|
||||
BarcodeFormat::ITF,
|
||||
);
|
||||
|
||||
@@ -157,8 +157,8 @@ impl Reader for MultiFormatOneDReader {
|
||||
);
|
||||
// Update result points
|
||||
let height = rotatedImage.getHeight();
|
||||
let total_points = result.getRXingResultPoints().len();
|
||||
let points = result.getRXingResultPointsMut();
|
||||
let total_points = result.getPoints().len();
|
||||
let points = result.getPointsMut();
|
||||
for point in points.iter_mut().take(total_points) {
|
||||
std::mem::swap(&mut point.x, &mut point.y);
|
||||
point.x = height as f32 - point.x - 1.0;
|
||||
|
||||
@@ -105,7 +105,7 @@ impl MultiFormatUPCEANReader {
|
||||
let mut resultUPCA = RXingResult::new(
|
||||
&result.getText()[1..],
|
||||
result.getRawBytes().clone(),
|
||||
result.getRXingResultPoints().clone(),
|
||||
result.getPoints().clone(),
|
||||
BarcodeFormat::UPC_A,
|
||||
);
|
||||
resultUPCA.putAllMetadata(result.getRXingResultMetadata().clone());
|
||||
@@ -189,8 +189,8 @@ impl Reader for MultiFormatUPCEANReader {
|
||||
);
|
||||
// Update result points
|
||||
let height = rotatedImage.getHeight();
|
||||
let total_points = result.getRXingResultPoints().len();
|
||||
let points = result.getRXingResultPointsMut();
|
||||
let total_points = result.getPoints().len();
|
||||
let points = result.getPointsMut();
|
||||
for point in points.iter_mut().take(total_points) {
|
||||
std::mem::swap(&mut point.x, &mut point.y);
|
||||
point.x = height as f32 - point.x - 1.0;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use crate::{
|
||||
common::{BitArray, Result},
|
||||
BinaryBitmap, DecodeHintType, DecodeHintValue, DecodingHintDictionary, Exceptions, RXingResult,
|
||||
RXingResultMetadataType, RXingResultMetadataValue, RXingResultPoint, Reader, ResultPoint,
|
||||
RXingResultMetadataType, RXingResultMetadataValue, Point, Reader, ResultPoint,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -115,13 +115,13 @@ pub trait OneDReader: Reader {
|
||||
RXingResultMetadataValue::Orientation(180),
|
||||
);
|
||||
// And remember to flip the result points horizontally.
|
||||
let points = result.getRXingResultPointsMut();
|
||||
let points = result.getPointsMut();
|
||||
if !points.is_empty() && points.len() >= 2 {
|
||||
points[0] = RXingResultPoint::new(
|
||||
points[0] = Point::new(
|
||||
width as f32 - points[0].getX() - 1.0,
|
||||
points[0].getY(),
|
||||
);
|
||||
points[1] = RXingResultPoint::new(
|
||||
points[1] = Point::new(
|
||||
width as f32 - points[1].getX() - 1.0,
|
||||
points[1].getY(),
|
||||
);
|
||||
|
||||
@@ -215,8 +215,8 @@ impl Reader for RSSExpandedReader {
|
||||
// Update result points
|
||||
let height = rotatedImage.getHeight();
|
||||
|
||||
let total_points = result.getRXingResultPoints().len();
|
||||
let points = result.getRXingResultPointsMut();
|
||||
let total_points = result.getPoints().len();
|
||||
let points = result.getPointsMut();
|
||||
for point in points.iter_mut().take(total_points) {
|
||||
std::mem::swap(&mut point.x, &mut point.y);
|
||||
point.x = height as f32 - point.x - 1.0;
|
||||
@@ -545,14 +545,14 @@ impl RSSExpandedReader {
|
||||
.getFinderPattern()
|
||||
.as_ref()
|
||||
.ok_or(Exceptions::IllegalStateException(None))?
|
||||
.getRXingResultPoints();
|
||||
.getPoints();
|
||||
let lastPoints = pairs
|
||||
.last()
|
||||
.ok_or(Exceptions::IndexOutOfBoundsException(None))?
|
||||
.getFinderPattern()
|
||||
.as_ref()
|
||||
.ok_or(Exceptions::IllegalStateException(None))?
|
||||
.getRXingResultPoints();
|
||||
.getPoints();
|
||||
|
||||
let mut result = RXingResult::new(
|
||||
&resultingString,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use std::hash::Hash;
|
||||
|
||||
use crate::RXingResultPoint;
|
||||
use crate::Point;
|
||||
|
||||
/**
|
||||
* Encapsulates an RSS barcode finder pattern, including its start/end position and row.
|
||||
@@ -25,7 +25,7 @@ use crate::RXingResultPoint;
|
||||
pub struct FinderPattern {
|
||||
value: u32,
|
||||
startEnd: [usize; 2],
|
||||
resultPoints: Vec<RXingResultPoint>,
|
||||
resultPoints: Vec<Point>,
|
||||
}
|
||||
|
||||
impl FinderPattern {
|
||||
@@ -34,8 +34,8 @@ impl FinderPattern {
|
||||
value,
|
||||
startEnd,
|
||||
resultPoints: vec![
|
||||
RXingResultPoint::new(start as f32, rowNumber as f32),
|
||||
RXingResultPoint::new(end as f32, rowNumber as f32),
|
||||
Point::new(start as f32, rowNumber as f32),
|
||||
Point::new(end as f32, rowNumber as f32),
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ impl FinderPattern {
|
||||
&mut self.startEnd
|
||||
}
|
||||
|
||||
pub fn getRXingResultPoints(&self) -> &[RXingResultPoint] {
|
||||
pub fn getPoints(&self) -> &[Point] {
|
||||
&self.resultPoints
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ use crate::{
|
||||
common::{BitArray, Result},
|
||||
oned::{one_d_reader, OneDReader},
|
||||
BarcodeFormat, DecodeHintType, DecodeHintValue, DecodingHintDictionary, Exceptions,
|
||||
RXingResult, RXingResultMetadataType, RXingResultMetadataValue, RXingResultPoint, Reader,
|
||||
RXingResult, RXingResultMetadataType, RXingResultMetadataValue, Point, Reader,
|
||||
};
|
||||
|
||||
use super::{
|
||||
@@ -114,8 +114,8 @@ impl Reader for RSS14Reader {
|
||||
);
|
||||
// Update result points
|
||||
let height = rotatedImage.getHeight();
|
||||
let total_points = result.getRXingResultPoints().len();
|
||||
let points = result.getRXingResultPointsMut();
|
||||
let total_points = result.getPoints().len();
|
||||
let points = result.getPointsMut();
|
||||
for point in points.iter_mut().take(total_points) {
|
||||
std::mem::swap(&mut point.x, &mut point.y);
|
||||
point.x = height as f32 - point.x - 1.0
|
||||
@@ -209,8 +209,8 @@ impl RSS14Reader {
|
||||
}
|
||||
buffer.push_str(&checkDigit.to_string());
|
||||
|
||||
let leftPoints = leftPair.getFinderPattern().getRXingResultPoints();
|
||||
let rightPoints = rightPair.getFinderPattern().getRXingResultPoints();
|
||||
let leftPoints = leftPair.getFinderPattern().getPoints();
|
||||
let rightPoints = rightPair.getFinderPattern().getPoints();
|
||||
let mut result = RXingResult::new(
|
||||
&buffer,
|
||||
Vec::new(),
|
||||
@@ -259,7 +259,7 @@ impl RSS14Reader {
|
||||
// row is actually reversed
|
||||
center = row.getSize() as f32 - 1.0 - center;
|
||||
}
|
||||
cb(&RXingResultPoint::new(center, rowNumber as f32));
|
||||
cb(&Point::new(center, rowNumber as f32));
|
||||
}
|
||||
|
||||
let outside = self.decodeDataCharacter(row, &pattern, true)?;
|
||||
|
||||
@@ -94,7 +94,7 @@ impl UPCAReader {
|
||||
let mut upcaRXingResult = RXingResult::new(
|
||||
stripped_text,
|
||||
Vec::new(),
|
||||
result.getRXingResultPoints().to_vec(),
|
||||
result.getPoints().to_vec(),
|
||||
BarcodeFormat::UPC_A,
|
||||
);
|
||||
upcaRXingResult.putAllMetadata(result.getRXingResultMetadata().clone());
|
||||
|
||||
@@ -19,7 +19,7 @@ use std::collections::HashMap;
|
||||
use crate::{
|
||||
common::{BitArray, Result},
|
||||
BarcodeFormat, Exceptions, RXingResult, RXingResultMetadataType, RXingResultMetadataValue,
|
||||
RXingResultPoint,
|
||||
Point,
|
||||
};
|
||||
|
||||
use super::{upc_ean_reader, UPCEANReader, STAND_IN};
|
||||
@@ -49,11 +49,11 @@ impl UPCEANExtension2Support {
|
||||
&resultString,
|
||||
Vec::new(),
|
||||
vec![
|
||||
RXingResultPoint::new(
|
||||
Point::new(
|
||||
(extensionStartRange[0] + extensionStartRange[1]) as f32 / 2.0,
|
||||
rowNumber as f32,
|
||||
),
|
||||
RXingResultPoint::new(end as f32, rowNumber as f32),
|
||||
Point::new(end as f32, rowNumber as f32),
|
||||
],
|
||||
BarcodeFormat::UPC_EAN_EXTENSION,
|
||||
);
|
||||
|
||||
@@ -19,7 +19,7 @@ use std::collections::HashMap;
|
||||
use crate::{
|
||||
common::{BitArray, Result},
|
||||
BarcodeFormat, Exceptions, RXingResult, RXingResultMetadataType, RXingResultMetadataValue,
|
||||
RXingResultPoint,
|
||||
Point,
|
||||
};
|
||||
|
||||
use super::{upc_ean_reader, UPCEANReader, STAND_IN};
|
||||
@@ -51,11 +51,11 @@ impl UPCEANExtension5Support {
|
||||
&resultString,
|
||||
Vec::new(),
|
||||
vec![
|
||||
RXingResultPoint::new(
|
||||
Point::new(
|
||||
(extensionStartRange[0] + extensionStartRange[1]) as f32 / 2.0,
|
||||
rowNumber as f32,
|
||||
),
|
||||
RXingResultPoint::new(end as f32, rowNumber as f32),
|
||||
Point::new(end as f32, rowNumber as f32),
|
||||
],
|
||||
BarcodeFormat::UPC_EAN_EXTENSION,
|
||||
);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use crate::{
|
||||
common::{BitArray, Result},
|
||||
BarcodeFormat, DecodeHintType, DecodeHintValue, Exceptions, RXingResult,
|
||||
RXingResultMetadataType, RXingResultMetadataValue, RXingResultPoint, Reader,
|
||||
RXingResultMetadataType, RXingResultMetadataValue, Point, Reader,
|
||||
};
|
||||
|
||||
use super::{one_d_reader, EANManufacturerOrgSupport, OneDReader, UPCEANExtensionSupport};
|
||||
@@ -156,7 +156,7 @@ pub trait UPCEANReader: OneDReader {
|
||||
let mut symbologyIdentifier = 0;
|
||||
|
||||
if let Some(DecodeHintValue::NeedResultPointCallback(cb)) = resultPointCallback {
|
||||
cb(&RXingResultPoint::new(
|
||||
cb(&Point::new(
|
||||
(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(&RXingResultPoint::new(endStart as f32, rowNumber as f32));
|
||||
cb(&Point::new(endStart as f32, rowNumber as f32));
|
||||
}
|
||||
|
||||
let endRange = self.decodeEnd(row, endStart)?;
|
||||
|
||||
if let Some(DecodeHintValue::NeedResultPointCallback(cb)) = resultPointCallback {
|
||||
cb(&RXingResultPoint::new(
|
||||
cb(&Point::new(
|
||||
(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![
|
||||
RXingResultPoint::new(left, rowNumber as f32),
|
||||
RXingResultPoint::new(right, rowNumber as f32),
|
||||
Point::new(left, rowNumber as f32),
|
||||
Point::new(right, rowNumber as f32),
|
||||
],
|
||||
format,
|
||||
);
|
||||
@@ -224,7 +224,7 @@ pub trait UPCEANReader: OneDReader {
|
||||
);
|
||||
decodeRXingResult.putAllMetadata(extensionRXingResult.getRXingResultMetadata().clone());
|
||||
decodeRXingResult
|
||||
.addRXingResultPoints(&mut extensionRXingResult.getRXingResultPoints().clone());
|
||||
.addPoints(&mut extensionRXingResult.getPoints().clone());
|
||||
extensionLength = extensionRXingResult.getText().chars().count();
|
||||
Ok(())
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user