mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 12:22: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:
@@ -17,7 +17,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::common::Result;
|
||||
use crate::{Exceptions, RXingResult, RXingResultPoint, Reader, ResultPoint};
|
||||
use crate::{Exceptions, RXingResult, Point, Reader, ResultPoint};
|
||||
|
||||
/**
|
||||
* This class attempts to decode a barcode from an image, not by scanning the whole image,
|
||||
@@ -61,7 +61,7 @@ impl<T: Reader> Reader for ByQuadrantReader<T> {
|
||||
// This is a match because only NotFoundExceptions should be ignored
|
||||
match result {
|
||||
Ok(res) => {
|
||||
let points = Self::makeAbsolute(res.getRXingResultPoints(), halfWidth as f32, 0.0);
|
||||
let points = Self::makeAbsolute(res.getPoints(), halfWidth as f32, 0.0);
|
||||
return Ok(RXingResult::new_from_existing_result(res, points));
|
||||
}
|
||||
Err(Exceptions::NotFoundException(_)) => {}
|
||||
@@ -74,7 +74,7 @@ impl<T: Reader> Reader for ByQuadrantReader<T> {
|
||||
// This is a match because only NotFoundExceptions should be ignored
|
||||
match result {
|
||||
Ok(res) => {
|
||||
let points = Self::makeAbsolute(res.getRXingResultPoints(), 0.0, halfHeight as f32);
|
||||
let points = Self::makeAbsolute(res.getPoints(), 0.0, halfHeight as f32);
|
||||
return Ok(RXingResult::new_from_existing_result(res, points));
|
||||
}
|
||||
Err(Exceptions::NotFoundException(_)) => {}
|
||||
@@ -89,7 +89,7 @@ impl<T: Reader> Reader for ByQuadrantReader<T> {
|
||||
match result {
|
||||
Ok(res) => {
|
||||
let points = Self::makeAbsolute(
|
||||
res.getRXingResultPoints(),
|
||||
res.getPoints(),
|
||||
halfWidth as f32,
|
||||
halfHeight as f32,
|
||||
);
|
||||
@@ -105,7 +105,7 @@ impl<T: Reader> Reader for ByQuadrantReader<T> {
|
||||
let result = self.0.decode_with_hints(&mut center, hints)?;
|
||||
|
||||
let points = Self::makeAbsolute(
|
||||
result.getRXingResultPoints(),
|
||||
result.getPoints(),
|
||||
quarterWidth as f32,
|
||||
quarterHeight as f32,
|
||||
);
|
||||
@@ -123,15 +123,15 @@ impl<T: Reader> ByQuadrantReader<T> {
|
||||
}
|
||||
|
||||
fn makeAbsolute(
|
||||
points: &[RXingResultPoint],
|
||||
points: &[Point],
|
||||
leftOffset: f32,
|
||||
topOffset: f32,
|
||||
) -> Vec<RXingResultPoint> {
|
||||
) -> Vec<Point> {
|
||||
// let mut result = Vec::new();
|
||||
// if !points.is_empty() {
|
||||
|
||||
// // for relative in points {
|
||||
// // result.push(RXingResultPoint::new(
|
||||
// // result.push(Point::new(
|
||||
// // relative.getX() + leftOffset,
|
||||
// // relative.getY() + topOffset,
|
||||
// // ));
|
||||
@@ -141,7 +141,7 @@ impl<T: Reader> ByQuadrantReader<T> {
|
||||
points
|
||||
.iter()
|
||||
.map(|relative| {
|
||||
RXingResultPoint::new(relative.getX() + leftOffset, relative.getY() + topOffset)
|
||||
Point::new(relative.getX() + leftOffset, relative.getY() + topOffset)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user