change PointCallback to accept Point instead of ResultPoint

This commit is contained in:
Vukašin Stepanović
2023-02-16 16:20:53 +00:00
parent 0992e85e6c
commit 072d3d0ec7
6 changed files with 8 additions and 8 deletions

View File

@@ -92,7 +92,7 @@ impl Reader for AztecReader {
{
// if let DecodeHintValue::NeedResultPointCallback(cb) = rpcb {
for point in points {
cb(point);
cb(*point);
}
// }
}

View File

@@ -36,7 +36,7 @@ pub use encode_hints::*;
/// Callback which is invoked when a possible result point (significant
/// point in the barcode image such as a corner) is found.
pub type PointCallback = Rc<dyn Fn(&dyn ResultPoint)>;
pub type PointCallback = Rc<dyn Fn(Point)>;
/** Temporary type to ease refactoring and keep backwards-compatibility */
pub type RXingResultPointCallback = PointCallback;

View File

@@ -259,7 +259,7 @@ impl RSS14Reader {
// row is actually reversed
center = row.getSize() as f32 - 1.0 - center;
}
cb(&point(center, rowNumber as f32));
cb(point(center, rowNumber as f32));
}
let outside = self.decodeDataCharacter(row, &pattern, true)?;

View File

@@ -156,7 +156,7 @@ pub trait UPCEANReader: OneDReader {
let mut symbologyIdentifier = 0;
if let Some(DecodeHintValue::NeedResultPointCallback(cb)) = resultPointCallback {
cb(&point(
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(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(
cb(point(
(endRange[0] + endRange[1]) as f32 / 2.0,
rowNumber as f32,
));

View File

@@ -311,7 +311,7 @@ impl AlignmentPatternFinder {
// Hadn't found this before; save it
let point = AlignmentPattern::new(centerJ, centerI, estimatedModuleSize);
if let Some(rpc) = self.resultPointCallback.clone() {
rpc(&point);
rpc((&point).into());
}
self.possibleCenters.push(point);

View File

@@ -603,7 +603,7 @@ impl<'a> FinderPatternFinder<'_> {
let point = FinderPattern::new(centerJ, centerI, estimatedModuleSize);
self.possibleCenters.push(point);
if let Some(rpc) = self.resultPointCallback.clone() {
rpc(&point);
rpc((&point).into());
}
}
return true;