mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
cargo fmt
This commit is contained in:
@@ -39,7 +39,7 @@ use rand::Rng;
|
||||
use crate::{aztec::decoder, common::BitMatrix, exceptions::Exceptions};
|
||||
|
||||
use super::{
|
||||
detector::{self, Detector, AztecPoint},
|
||||
detector::{self, AztecPoint, Detector},
|
||||
encoder::{self, AztecCode},
|
||||
};
|
||||
|
||||
@@ -271,7 +271,10 @@ fn get_orientation_points(code: &AztecCode) -> Vec<AztecPoint> {
|
||||
let mut ySign: i32 = -1;
|
||||
while ySign <= 1 {
|
||||
// for (int ySign = -1; ySign <= 1; ySign += 2) {
|
||||
result.push(AztecPoint::new(center + xSign * offset, center + ySign * offset));
|
||||
result.push(AztecPoint::new(
|
||||
center + xSign * offset,
|
||||
center + ySign * offset,
|
||||
));
|
||||
result.push(AztecPoint::new(
|
||||
center + xSign * (offset - 1),
|
||||
center + ySign * offset,
|
||||
|
||||
@@ -325,14 +325,10 @@ impl<'a> Detector<'_> {
|
||||
|
||||
// Expand the square by .5 pixel in each direction so that we're on the border
|
||||
// between the white square and the black square
|
||||
let pinax =
|
||||
Point::new(pina.get_x() as f32 + 0.5f32, pina.get_y() as f32 - 0.5f32);
|
||||
let pinbx =
|
||||
Point::new(pinb.get_x() as f32 + 0.5f32, pinb.get_y() as f32 + 0.5f32);
|
||||
let pincx =
|
||||
Point::new(pinc.get_x() as f32 - 0.5f32, pinc.get_y() as f32 + 0.5f32);
|
||||
let pindx =
|
||||
Point::new(pind.get_x() as f32 - 0.5f32, pind.get_y() as f32 - 0.5f32);
|
||||
let pinax = Point::new(pina.get_x() as f32 + 0.5f32, pina.get_y() as f32 - 0.5f32);
|
||||
let pinbx = Point::new(pinb.get_x() as f32 + 0.5f32, pinb.get_y() as f32 + 0.5f32);
|
||||
let pincx = Point::new(pinc.get_x() as f32 - 0.5f32, pinc.get_y() as f32 + 0.5f32);
|
||||
let pindx = Point::new(pind.get_x() as f32 - 0.5f32, pind.get_y() as f32 - 0.5f32);
|
||||
|
||||
// Expand the square so that its corners are the centers of the points
|
||||
// just outside the bull's eye.
|
||||
@@ -475,10 +471,7 @@ impl<'a> Detector<'_> {
|
||||
* @param bullsEyeCorners the array of bull's eye corners
|
||||
* @return the array of aztec code corners
|
||||
*/
|
||||
fn get_matrix_corner_points(
|
||||
&self,
|
||||
bulls_eye_corners: &[Point],
|
||||
) -> [Point; 4] {
|
||||
fn get_matrix_corner_points(&self, bulls_eye_corners: &[Point]) -> [Point; 4] {
|
||||
Self::expand_square(
|
||||
bulls_eye_corners,
|
||||
2 * self.nb_center_layers,
|
||||
@@ -561,7 +554,13 @@ impl<'a> Detector<'_> {
|
||||
* @return true if the border of the rectangle passed in parameter is compound of white points only
|
||||
* or black points only
|
||||
*/
|
||||
fn is_white_or_black_rectangle(&self, p1: &AztecPoint, p2: &AztecPoint, p3: &AztecPoint, p4: &AztecPoint) -> bool {
|
||||
fn is_white_or_black_rectangle(
|
||||
&self,
|
||||
p1: &AztecPoint,
|
||||
p2: &AztecPoint,
|
||||
p3: &AztecPoint,
|
||||
p4: &AztecPoint,
|
||||
) -> bool {
|
||||
let corr = 3;
|
||||
|
||||
let p1 = AztecPoint::new(
|
||||
@@ -690,11 +689,7 @@ impl<'a> Detector<'_> {
|
||||
* @param newSide the new length of the size of the square in the target bit matrix
|
||||
* @return the corners of the expanded square
|
||||
*/
|
||||
fn expand_square(
|
||||
corner_points: &[Point],
|
||||
old_side: u32,
|
||||
new_side: u32,
|
||||
) -> [Point; 4] {
|
||||
fn expand_square(corner_points: &[Point], old_side: u32, new_side: u32) -> [Point; 4] {
|
||||
let ratio = new_side as f32 / (2.0f32 * old_side as f32);
|
||||
|
||||
let d = corner_points[0] - corner_points[2];
|
||||
|
||||
@@ -289,13 +289,7 @@ impl<'a> WhiteRectangleDetector<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_black_point_on_segment(
|
||||
&self,
|
||||
a_x: f32,
|
||||
a_y: f32,
|
||||
b_x: f32,
|
||||
b_y: f32,
|
||||
) -> Option<Point> {
|
||||
fn get_black_point_on_segment(&self, a_x: f32, a_y: f32, b_x: f32, b_y: f32) -> Option<Point> {
|
||||
let dist = MathUtils::round(MathUtils::distance(a_x, a_y, b_x, b_y));
|
||||
let x_step: f32 = (b_x - a_x) / dist as f32;
|
||||
let y_step: f32 = (b_y - a_y) / dist as f32;
|
||||
@@ -323,13 +317,7 @@ impl<'a> WhiteRectangleDetector<'_> {
|
||||
* point and the last, the bottommost. The second point will be
|
||||
* leftmost and the third, the rightmost
|
||||
*/
|
||||
fn center_edges(
|
||||
&self,
|
||||
y: Point,
|
||||
z: Point,
|
||||
x: Point,
|
||||
t: Point,
|
||||
) -> [Point; 4] {
|
||||
fn center_edges(&self, y: Point, z: Point, x: Point, t: Point) -> [Point; 4] {
|
||||
//
|
||||
// t t
|
||||
// z x
|
||||
|
||||
@@ -17,9 +17,9 @@ pub trait BitMatrixCursor {
|
||||
// BitMatrixCursor(const BitMatrix& image, POINT p, POINT d) : img(&image), p(p) { setDirection(d); }
|
||||
|
||||
fn testAt(&self, p: Point) -> Value; //const
|
||||
// {
|
||||
// return img->isIn(p) ? Value{img->get(p)} : Value{};
|
||||
// }
|
||||
// {
|
||||
// return img->isIn(p) ? Value{img->get(p)} : Value{};
|
||||
// }
|
||||
|
||||
fn blackAt(&self, pos: Point) -> bool {
|
||||
self.testAt(pos).isBlack()
|
||||
@@ -69,7 +69,7 @@ pub trait BitMatrixCursor {
|
||||
}
|
||||
|
||||
fn setDirection(&mut self, dir: Point); // { d = bresenhamDirection(dir); }
|
||||
// fn setDirection(&self, dir: Point);// { d = dir; }
|
||||
// fn setDirection(&self, dir: Point);// { d = dir; }
|
||||
|
||||
fn step(&mut self, s: Option<f32>) -> bool; // DEF to 1
|
||||
// {
|
||||
|
||||
@@ -197,14 +197,8 @@ fn Scan(
|
||||
|
||||
CHECK!((10..=144).contains(&dimT) && (8..=144).contains(&dimR));
|
||||
|
||||
let movedTowardsBy = |a: Point,
|
||||
b1: Point,
|
||||
b2: Point,
|
||||
d: f32|
|
||||
-> Point {
|
||||
a + d * Point::normalized(
|
||||
Point::normalized(b1 - a) + Point::normalized(b2 - a),
|
||||
)
|
||||
let movedTowardsBy = |a: Point, b1: Point, b2: Point, d: f32| -> Point {
|
||||
a + d * Point::normalized(Point::normalized(b1 - a) + Point::normalized(b2 - a))
|
||||
};
|
||||
|
||||
// shrink shape by half a pixel to go from center of white pixel outside of code to the edge between white and black
|
||||
@@ -302,8 +296,7 @@ pub fn detect(
|
||||
x: (image.getWidth() / 2) as f32,
|
||||
y: (image.getHeight() / 2) as f32,
|
||||
}; //PointF(image.width() / 2, image.height() / 2);
|
||||
let startPos =
|
||||
Point::centered(center - center * dir + MIN_SYMBOL_SIZE as i32 / 2 * dir);
|
||||
let startPos = Point::centered(center - center * dir + MIN_SYMBOL_SIZE as i32 / 2 * dir);
|
||||
|
||||
if let Some(history) = &mut history {
|
||||
history.borrow_mut().clear(0);
|
||||
|
||||
@@ -37,8 +37,7 @@ impl RegressionLine for DMRegressionLine {
|
||||
|
||||
fn length(&self) -> u32 {
|
||||
if self.points.len() >= 2 {
|
||||
Point::distance(*self.points.first().unwrap(), *self.points.last().unwrap())
|
||||
as u32
|
||||
Point::distance(*self.points.first().unwrap(), *self.points.last().unwrap()) as u32
|
||||
} else {
|
||||
0
|
||||
}
|
||||
|
||||
@@ -252,21 +252,14 @@ impl<'a> EdgeTracer<'_> {
|
||||
}
|
||||
// make sure d stays in the same quadrant to prevent an infinite loop
|
||||
if (self.d.x).abs() == (self.d.y).abs() {
|
||||
self.d = Point::mainDirection(old_d)
|
||||
+ 0.99 * (self.d - Point::mainDirection(old_d));
|
||||
} else if Point::mainDirection(self.d) != Point::mainDirection(old_d)
|
||||
{
|
||||
self.d = Point::mainDirection(old_d)
|
||||
+ 0.99 * Point::mainDirection(self.d);
|
||||
self.d = Point::mainDirection(old_d) + 0.99 * (self.d - Point::mainDirection(old_d));
|
||||
} else if Point::mainDirection(self.d) != Point::mainDirection(old_d) {
|
||||
self.d = Point::mainDirection(old_d) + 0.99 * Point::mainDirection(self.d);
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
pub fn traceLine<T: RegressionLine>(
|
||||
&mut self,
|
||||
dEdge: Point,
|
||||
line: &mut T,
|
||||
) -> Result<bool> {
|
||||
pub fn traceLine<T: RegressionLine>(&mut self, dEdge: Point, line: &mut T) -> Result<bool> {
|
||||
line.setDirectionInward(dEdge);
|
||||
loop {
|
||||
// log(self.p);
|
||||
@@ -341,9 +334,7 @@ impl<'a> EdgeTracer<'_> {
|
||||
// In case the 'go outward' step in traceStep lead us astray, we might end up with a line
|
||||
// that is almost perpendicular to d. Then the back-projection below can result in an
|
||||
// endless loop. Break if the angle between d and line is greater than 45 deg.
|
||||
if (Point::dot(Point::normalized(self.d), line.normal()))
|
||||
.abs()
|
||||
> 0.7
|
||||
if (Point::dot(Point::normalized(self.d), line.normal())).abs() > 0.7
|
||||
// thresh is approx. sin(45 deg)
|
||||
{
|
||||
return Ok(false);
|
||||
@@ -439,11 +430,7 @@ impl<'a> EdgeTracer<'_> {
|
||||
} //while (true);
|
||||
}
|
||||
|
||||
pub fn traceCorner(
|
||||
&mut self,
|
||||
dir: &mut Point,
|
||||
corner: &mut Point,
|
||||
) -> Result<bool> {
|
||||
pub fn traceCorner(&mut self, dir: &mut Point, corner: &mut Point) -> Result<bool> {
|
||||
self.step(None);
|
||||
// log(p);
|
||||
*corner = self.p;
|
||||
|
||||
@@ -17,12 +17,7 @@ impl Quadrilateral {
|
||||
// Self([tl, tr,br, bl ])
|
||||
// }
|
||||
|
||||
pub fn with_points(
|
||||
tl: Point,
|
||||
tr: Point,
|
||||
br: Point,
|
||||
bl: Point,
|
||||
) -> Self {
|
||||
pub fn with_points(tl: Point, tr: Point, br: Point, bl: Point) -> Self {
|
||||
Self([tl, tr, br, bl])
|
||||
}
|
||||
|
||||
|
||||
@@ -78,11 +78,11 @@ pub trait RegressionLine {
|
||||
// }
|
||||
|
||||
fn add(&mut self, p: Point) -> Result<()>; //{
|
||||
// assert(_directionInward != PointF());
|
||||
// _points.push_back(p);
|
||||
// if (_points.size() == 1)
|
||||
// c = dot(normal(), p);
|
||||
// }
|
||||
// assert(_directionInward != PointF());
|
||||
// _points.push_back(p);
|
||||
// if (_points.size() == 1)
|
||||
// c = dot(normal(), p);
|
||||
// }
|
||||
|
||||
fn pop_back(&mut self); // { _points.pop_back(); }
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::common::Result;
|
||||
use crate::{Exceptions, RXingResult, Point, Reader, ResultPoint};
|
||||
use crate::{Exceptions, Point, RXingResult, Reader, ResultPoint};
|
||||
|
||||
/**
|
||||
* This class attempts to decode a barcode from an image, not by scanning the whole image,
|
||||
@@ -88,11 +88,8 @@ 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.getPoints(),
|
||||
halfWidth as f32,
|
||||
halfHeight as f32,
|
||||
);
|
||||
let points =
|
||||
Self::makeAbsolute(res.getPoints(), halfWidth as f32, halfHeight as f32);
|
||||
return Ok(RXingResult::new_from_existing_result(res, points));
|
||||
}
|
||||
Err(Exceptions::NotFoundException(_)) => {}
|
||||
@@ -122,11 +119,7 @@ impl<T: Reader> ByQuadrantReader<T> {
|
||||
Self(delegate)
|
||||
}
|
||||
|
||||
fn makeAbsolute(
|
||||
points: &[Point],
|
||||
leftOffset: f32,
|
||||
topOffset: f32,
|
||||
) -> Vec<Point> {
|
||||
fn makeAbsolute(points: &[Point], leftOffset: f32, topOffset: f32) -> Vec<Point> {
|
||||
// let mut result = Vec::new();
|
||||
// if !points.is_empty() {
|
||||
|
||||
@@ -140,9 +133,7 @@ impl<T: Reader> ByQuadrantReader<T> {
|
||||
// result
|
||||
points
|
||||
.iter()
|
||||
.map(|relative| {
|
||||
Point::new(relative.getX() + leftOffset, relative.getY() + topOffset)
|
||||
})
|
||||
.map(|relative| Point::new(relative.getX() + leftOffset, relative.getY() + topOffset))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::{
|
||||
common::Result, BinaryBitmap, DecodingHintDictionary, Exceptions, RXingResult,
|
||||
Point, Reader, ResultPoint,
|
||||
common::Result, BinaryBitmap, DecodingHintDictionary, Exceptions, Point, RXingResult, Reader,
|
||||
ResultPoint,
|
||||
};
|
||||
|
||||
use super::MultipleBarcodeReader;
|
||||
|
||||
@@ -19,8 +19,7 @@ use std::cmp::Ordering;
|
||||
use crate::{
|
||||
common::{BitMatrix, Result},
|
||||
qrcode::detector::{FinderPattern, FinderPatternFinder, FinderPatternInfo},
|
||||
result_point_utils, DecodeHintType, DecodingHintDictionary, Exceptions,
|
||||
PointCallback,
|
||||
result_point_utils, DecodeHintType, DecodingHintDictionary, Exceptions, PointCallback,
|
||||
};
|
||||
|
||||
// max. legal count of modules per QR code edge (177)
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
use rxing_one_d_proc_derive::OneDReader;
|
||||
|
||||
use crate::common::{BitArray, Result};
|
||||
use crate::{BarcodeFormat, Point};
|
||||
use crate::DecodeHintValue;
|
||||
use crate::Exceptions;
|
||||
use crate::RXingResult;
|
||||
use crate::{BarcodeFormat, Point};
|
||||
|
||||
use super::OneDReader;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ use rxing_one_d_proc_derive::OneDReader;
|
||||
|
||||
use crate::{
|
||||
common::{BitArray, Result},
|
||||
BarcodeFormat, Exceptions, RXingResult, Point,
|
||||
BarcodeFormat, Exceptions, Point, RXingResult,
|
||||
};
|
||||
|
||||
use super::{one_d_reader, OneDReader};
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use rxing_one_d_proc_derive::OneDReader;
|
||||
|
||||
use crate::common::{BitArray, Result};
|
||||
use crate::{BarcodeFormat, Exceptions, RXingResult, Point};
|
||||
use crate::{BarcodeFormat, Exceptions, Point, RXingResult};
|
||||
|
||||
use super::{one_d_reader, OneDReader};
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ use rxing_one_d_proc_derive::OneDReader;
|
||||
|
||||
use crate::{
|
||||
common::{BitArray, Result},
|
||||
BarcodeFormat, Exceptions, RXingResult, Point,
|
||||
BarcodeFormat, Exceptions, Point, RXingResult,
|
||||
};
|
||||
|
||||
use super::{one_d_reader, OneDReader};
|
||||
|
||||
@@ -18,7 +18,7 @@ use rxing_one_d_proc_derive::OneDReader;
|
||||
|
||||
use crate::{
|
||||
common::{BitArray, Result},
|
||||
BarcodeFormat, DecodeHintValue, Exceptions, RXingResult, Point,
|
||||
BarcodeFormat, DecodeHintValue, Exceptions, Point, RXingResult,
|
||||
};
|
||||
|
||||
use super::{one_d_reader, OneDReader};
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
use crate::{
|
||||
common::{BitArray, Result},
|
||||
BinaryBitmap, DecodeHintType, DecodeHintValue, DecodingHintDictionary, Exceptions, RXingResult,
|
||||
RXingResultMetadataType, RXingResultMetadataValue, Point, Reader, ResultPoint,
|
||||
BinaryBitmap, DecodeHintType, DecodeHintValue, DecodingHintDictionary, Exceptions, Point,
|
||||
RXingResult, RXingResultMetadataType, RXingResultMetadataValue, Reader, ResultPoint,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -117,14 +117,10 @@ pub trait OneDReader: Reader {
|
||||
// And remember to flip the result points horizontally.
|
||||
let points = result.getPointsMut();
|
||||
if !points.is_empty() && points.len() >= 2 {
|
||||
points[0] = Point::new(
|
||||
width as f32 - points[0].getX() - 1.0,
|
||||
points[0].getY(),
|
||||
);
|
||||
points[1] = Point::new(
|
||||
width as f32 - points[1].getX() - 1.0,
|
||||
points[1].getY(),
|
||||
);
|
||||
points[0] =
|
||||
Point::new(width as f32 - points[0].getX() - 1.0, points[0].getY());
|
||||
points[1] =
|
||||
Point::new(width as f32 - points[1].getX() - 1.0, points[1].getY());
|
||||
}
|
||||
}
|
||||
return Ok(result);
|
||||
|
||||
@@ -19,8 +19,8 @@ use std::collections::HashMap;
|
||||
use crate::{
|
||||
common::{BitArray, Result},
|
||||
oned::{one_d_reader, OneDReader},
|
||||
BarcodeFormat, DecodeHintType, DecodeHintValue, DecodingHintDictionary, Exceptions,
|
||||
RXingResult, RXingResultMetadataType, RXingResultMetadataValue, Point, Reader,
|
||||
BarcodeFormat, DecodeHintType, DecodeHintValue, DecodingHintDictionary, Exceptions, Point,
|
||||
RXingResult, RXingResultMetadataType, RXingResultMetadataValue, Reader,
|
||||
};
|
||||
|
||||
use super::{
|
||||
|
||||
@@ -18,8 +18,8 @@ use std::collections::HashMap;
|
||||
|
||||
use crate::{
|
||||
common::{BitArray, Result},
|
||||
BarcodeFormat, Exceptions, RXingResult, RXingResultMetadataType, RXingResultMetadataValue,
|
||||
Point,
|
||||
BarcodeFormat, Exceptions, Point, RXingResult, RXingResultMetadataType,
|
||||
RXingResultMetadataValue,
|
||||
};
|
||||
|
||||
use super::{upc_ean_reader, UPCEANReader, STAND_IN};
|
||||
|
||||
@@ -18,8 +18,8 @@ use std::collections::HashMap;
|
||||
|
||||
use crate::{
|
||||
common::{BitArray, Result},
|
||||
BarcodeFormat, Exceptions, RXingResult, RXingResultMetadataType, RXingResultMetadataValue,
|
||||
Point,
|
||||
BarcodeFormat, Exceptions, Point, RXingResult, RXingResultMetadataType,
|
||||
RXingResultMetadataValue,
|
||||
};
|
||||
|
||||
use super::{upc_ean_reader, UPCEANReader, STAND_IN};
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
use crate::{
|
||||
common::{BitArray, Result},
|
||||
BarcodeFormat, DecodeHintType, DecodeHintValue, Exceptions, RXingResult,
|
||||
RXingResultMetadataType, RXingResultMetadataValue, Point, Reader,
|
||||
BarcodeFormat, DecodeHintType, DecodeHintValue, Exceptions, Point, RXingResult,
|
||||
RXingResultMetadataType, RXingResultMetadataValue, Reader,
|
||||
};
|
||||
|
||||
use super::{one_d_reader, EANManufacturerOrgSupport, OneDReader, UPCEANExtensionSupport};
|
||||
@@ -223,8 +223,7 @@ pub trait UPCEANReader: OneDReader {
|
||||
),
|
||||
);
|
||||
decodeRXingResult.putAllMetadata(extensionRXingResult.getRXingResultMetadata().clone());
|
||||
decodeRXingResult
|
||||
.addPoints(&mut extensionRXingResult.getPoints().clone());
|
||||
decodeRXingResult.addPoints(&mut extensionRXingResult.getPoints().clone());
|
||||
extensionLength = extensionRXingResult.getText().chars().count();
|
||||
Ok(())
|
||||
};
|
||||
|
||||
@@ -64,8 +64,7 @@ impl BoundingBox {
|
||||
newTopLeft = topLeft.ok_or(Exceptions::IllegalStateException(None))?;
|
||||
newBottomLeft = bottomLeft.ok_or(Exceptions::IllegalStateException(None))?;
|
||||
newTopRight = Point::new(image.getWidth() as f32 - 1.0, newTopLeft.getY());
|
||||
newBottomRight =
|
||||
Point::new(image.getWidth() as f32 - 1.0, newBottomLeft.getY());
|
||||
newBottomRight = Point::new(image.getWidth() as f32 - 1.0, newBottomLeft.getY());
|
||||
} else {
|
||||
newTopLeft = topLeft.ok_or(Exceptions::IllegalStateException(None))?;
|
||||
newTopRight = topRight.ok_or(Exceptions::IllegalStateException(None))?;
|
||||
|
||||
@@ -179,11 +179,7 @@ pub fn detect(multiple: bool, bitMatrix: &BitMatrix) -> Option<Vec<[Option<Point
|
||||
* vertices[6] x, y top right codeword area
|
||||
* vertices[7] x, y bottom right codeword area
|
||||
*/
|
||||
fn findVertices(
|
||||
matrix: &BitMatrix,
|
||||
startRow: u32,
|
||||
startColumn: u32,
|
||||
) -> Option<[Option<Point>; 8]> {
|
||||
fn findVertices(matrix: &BitMatrix, startRow: u32, startColumn: u32) -> Option<[Option<Point>; 8]> {
|
||||
let height = matrix.getHeight();
|
||||
let width = matrix.getWidth();
|
||||
let mut startRow = startRow;
|
||||
@@ -249,14 +245,8 @@ fn findRowsWithPattern(
|
||||
break;
|
||||
}
|
||||
}
|
||||
result[0] = Some(Point::new(
|
||||
loc_store.as_ref()?[0] as f32,
|
||||
startRow as f32,
|
||||
));
|
||||
result[1] = Some(Point::new(
|
||||
loc_store.as_ref()?[1] as f32,
|
||||
startRow as f32,
|
||||
));
|
||||
result[0] = Some(Point::new(loc_store.as_ref()?[0] as f32, startRow as f32));
|
||||
result[1] = Some(Point::new(loc_store.as_ref()?[1] as f32, startRow as f32));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@@ -304,14 +294,8 @@ fn findRowsWithPattern(
|
||||
stopRow += 1;
|
||||
}
|
||||
stopRow -= skippedRowCount + 1;
|
||||
result[2] = Some(Point::new(
|
||||
previousRowLoc[0] as f32,
|
||||
stopRow as f32,
|
||||
));
|
||||
result[3] = Some(Point::new(
|
||||
previousRowLoc[1] as f32,
|
||||
stopRow as f32,
|
||||
));
|
||||
result[2] = Some(Point::new(previousRowLoc[0] as f32, stopRow as f32));
|
||||
result[3] = Some(Point::new(previousRowLoc[1] as f32, stopRow as f32));
|
||||
}
|
||||
if stopRow - startRow < BARCODE_MIN_HEIGHT {
|
||||
result.fill(None);
|
||||
|
||||
@@ -26,11 +26,7 @@ pub struct PDF417DetectorRXingResult {
|
||||
}
|
||||
|
||||
impl PDF417DetectorRXingResult {
|
||||
pub fn with_rotation(
|
||||
bits: BitMatrix,
|
||||
points: Vec<[Option<Point>; 8]>,
|
||||
rotation: u32,
|
||||
) -> Self {
|
||||
pub fn with_rotation(bits: BitMatrix, points: Vec<[Option<Point>; 8]>, rotation: u32) -> Self {
|
||||
Self {
|
||||
bits,
|
||||
points,
|
||||
|
||||
@@ -18,8 +18,8 @@ use std::collections::HashMap;
|
||||
|
||||
use crate::{
|
||||
common::Result, multi::MultipleBarcodeReader, BarcodeFormat, BinaryBitmap,
|
||||
DecodingHintDictionary, Exceptions, RXingResult, RXingResultMetadataType,
|
||||
RXingResultMetadataValue, Point, Reader, ResultPoint,
|
||||
DecodingHintDictionary, Exceptions, Point, RXingResult, RXingResultMetadataType,
|
||||
RXingResultMetadataValue, Reader, ResultPoint,
|
||||
};
|
||||
|
||||
use super::{
|
||||
|
||||
@@ -18,8 +18,8 @@ use std::collections::HashMap;
|
||||
|
||||
use crate::{
|
||||
common::{BitMatrix, DecoderRXingResult, DetectorRXingResult, Result},
|
||||
BarcodeFormat, DecodeHintType, DecodeHintValue, Exceptions, RXingResult,
|
||||
RXingResultMetadataType, RXingResultMetadataValue, Point, Reader,
|
||||
BarcodeFormat, DecodeHintType, DecodeHintValue, Exceptions, Point, RXingResult,
|
||||
RXingResultMetadataType, RXingResultMetadataValue, Reader,
|
||||
};
|
||||
|
||||
use super::{
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use std::{collections::HashMap, fmt};
|
||||
|
||||
use crate::{BarcodeFormat, RXingResultMetadataType, RXingResultMetadataValue, Point};
|
||||
use crate::{BarcodeFormat, Point, RXingResultMetadataType, RXingResultMetadataValue};
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
Reference in New Issue
Block a user