mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 21:02:35 +00:00
return a slice for RXingResultPoints
This commit is contained in:
@@ -44,7 +44,7 @@ impl DetectorRXingResult for AztecDetectorRXingResult {
|
|||||||
&self.bits
|
&self.bits
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getPoints(&self) -> &Vec<RXingResultPoint> {
|
fn getPoints(&self) -> &[RXingResultPoint] {
|
||||||
&self.points
|
&self.points
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ pub use bit_array::*;
|
|||||||
pub trait DetectorRXingResult {
|
pub trait DetectorRXingResult {
|
||||||
fn getBits(&self) -> &BitMatrix;
|
fn getBits(&self) -> &BitMatrix;
|
||||||
|
|
||||||
fn getPoints(&self) -> &Vec<RXingResultPoint>;
|
fn getPoints(&self) -> &[RXingResultPoint];
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub struct DetectorRXingResult {
|
// pub struct DetectorRXingResult {
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ impl Reader for DataMatrixReader {
|
|||||||
} else {
|
} else {
|
||||||
let detectorRXingResult = Detector::new(image.getBlackMatrix())?.detect()?;
|
let detectorRXingResult = Detector::new(image.getBlackMatrix())?.detect()?;
|
||||||
decoderRXingResult = DECODER.decode(detectorRXingResult.getBits())?;
|
decoderRXingResult = DECODER.decode(detectorRXingResult.getBits())?;
|
||||||
points = detectorRXingResult.getPoints().clone();
|
points = detectorRXingResult.getPoints().to_vec();
|
||||||
}
|
}
|
||||||
let mut result = RXingResult::new(
|
let mut result = RXingResult::new(
|
||||||
decoderRXingResult.getText(),
|
decoderRXingResult.getText(),
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ impl DetectorRXingResult for DatamatrixDetectorResult {
|
|||||||
&self.0
|
&self.0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getPoints(&self) -> &Vec<RXingResultPoint> {
|
fn getPoints(&self) -> &[RXingResultPoint] {
|
||||||
&self.1
|
&self.1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ impl MultipleBarcodeReader for QRCodeMultiReader {
|
|||||||
detectorRXingResult.getBits(),
|
detectorRXingResult.getBits(),
|
||||||
hints,
|
hints,
|
||||||
)?;
|
)?;
|
||||||
let mut points = detectorRXingResult.getPoints().clone();
|
let mut points = detectorRXingResult.getPoints().to_vec();
|
||||||
// If the code was mirrored: swap the bottom-left and the top-right points.
|
// If the code was mirrored: swap the bottom-left and the top-right points.
|
||||||
if let Some(other) = decoderRXingResult.getOther() {
|
if let Some(other) = decoderRXingResult.getOther() {
|
||||||
if other.is::<QRCodeDecoderMetaData>() {
|
if other.is::<QRCodeDecoderMetaData>() {
|
||||||
@@ -73,7 +73,7 @@ impl MultipleBarcodeReader for QRCodeMultiReader {
|
|||||||
let mut result = RXingResult::new(
|
let mut result = RXingResult::new(
|
||||||
decoderRXingResult.getText(),
|
decoderRXingResult.getText(),
|
||||||
decoderRXingResult.getRawBytes().clone(),
|
decoderRXingResult.getRawBytes().clone(),
|
||||||
points,
|
points.to_vec(),
|
||||||
BarcodeFormat::QR_CODE,
|
BarcodeFormat::QR_CODE,
|
||||||
);
|
);
|
||||||
let byteSegments = decoderRXingResult.getByteSegments();
|
let byteSegments = decoderRXingResult.getByteSegments();
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ impl DetectorRXingResult for QRCodeDetectorResult {
|
|||||||
&self.bit_source
|
&self.bit_source
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getPoints(&self) -> &Vec<crate::RXingResultPoint> {
|
fn getPoints(&self) -> &[crate::RXingResultPoint] {
|
||||||
&self.result_points
|
&self.result_points
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ impl Reader for QRCodeReader {
|
|||||||
Detector::new(image.getBlackMatrix()).detect_with_hints(hints)?;
|
Detector::new(image.getBlackMatrix()).detect_with_hints(hints)?;
|
||||||
decoderRXingResult =
|
decoderRXingResult =
|
||||||
qrcode_decoder::decode_bitmatrix_with_hints(detectorRXingResult.getBits(), hints)?;
|
qrcode_decoder::decode_bitmatrix_with_hints(detectorRXingResult.getBits(), hints)?;
|
||||||
points = detectorRXingResult.getPoints().clone();
|
points = detectorRXingResult.getPoints().to_vec();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the code was mirrored: swap the bottom-left and the top-right points.
|
// If the code was mirrored: swap the bottom-left and the top-right points.
|
||||||
|
|||||||
Reference in New Issue
Block a user