mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
add point(x: f32, y: f32) function
Shorter than writing `Point::new`
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::common::Result;
|
||||
use crate::{Exceptions, Point, RXingResult, Reader, ResultPoint};
|
||||
use crate::{point, Exceptions, Point, RXingResult, Reader, ResultPoint};
|
||||
|
||||
/**
|
||||
* This class attempts to decode a barcode from an image, not by scanning the whole image,
|
||||
@@ -124,7 +124,7 @@ impl<T: Reader> ByQuadrantReader<T> {
|
||||
// if !points.is_empty() {
|
||||
|
||||
// // for relative in points {
|
||||
// // result.push(Point::new(
|
||||
// // result.push(point(
|
||||
// // relative.getX() + leftOffset,
|
||||
// // relative.getY() + topOffset,
|
||||
// // ));
|
||||
@@ -133,7 +133,7 @@ impl<T: Reader> ByQuadrantReader<T> {
|
||||
// result
|
||||
points
|
||||
.iter()
|
||||
.map(|relative| Point::new(relative.getX() + leftOffset, relative.getY() + topOffset))
|
||||
.map(|relative| point(relative.getX() + leftOffset, relative.getY() + topOffset))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::{
|
||||
common::Result, BinaryBitmap, DecodingHintDictionary, Exceptions, Point, RXingResult, Reader,
|
||||
ResultPoint,
|
||||
common::Result, point, BinaryBitmap, DecodingHintDictionary, Exceptions, Point, RXingResult,
|
||||
Reader, ResultPoint,
|
||||
};
|
||||
|
||||
use super::MultipleBarcodeReader;
|
||||
@@ -186,7 +186,7 @@ impl<T: Reader> GenericMultipleBarcodeReader<T> {
|
||||
let newPoints: Vec<Point> = oldPoints
|
||||
.iter()
|
||||
.map(|oldPoint| {
|
||||
Point::new(
|
||||
point(
|
||||
oldPoint.getX() + xOffset as f32,
|
||||
oldPoint.getY() + yOffset as f32,
|
||||
)
|
||||
@@ -195,7 +195,7 @@ impl<T: Reader> GenericMultipleBarcodeReader<T> {
|
||||
|
||||
// let mut newPoints = Vec::with_capacity(oldPoints.len());
|
||||
// for oldPoint in oldPoints {
|
||||
// newPoints.push(Point::new(
|
||||
// newPoints.push(point(
|
||||
// oldPoint.getX() + xOffset as f32,
|
||||
// oldPoint.getY() + yOffset as f32,
|
||||
// ));
|
||||
|
||||
Reference in New Issue
Block a user