mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
change PointCallback to accept Point instead of ResultPoint
This commit is contained in:
@@ -92,7 +92,7 @@ impl Reader for AztecReader {
|
||||
{
|
||||
// if let DecodeHintValue::NeedResultPointCallback(cb) = rpcb {
|
||||
for point in points {
|
||||
cb(point);
|
||||
cb(*point);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)?;
|
||||
|
||||
@@ -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,
|
||||
));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user