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