From c0c40abc9c480cd90eca2b78ab8651bccf41b36b Mon Sep 17 00:00:00 2001 From: Henry Schimke Date: Wed, 24 Aug 2022 16:53:02 -0500 Subject: [PATCH] DetectorRXingResult --- src/common/DetectorResult.java | 46 ---------------------------- src/common/mod.rs | 56 ++++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 49 deletions(-) delete mode 100644 src/common/DetectorResult.java diff --git a/src/common/DetectorResult.java b/src/common/DetectorResult.java deleted file mode 100644 index 005ae38..0000000 --- a/src/common/DetectorResult.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2007 ZXing authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.zxing.common; - -import com.google.zxing.RXingResultPoint; - -/** - *

Encapsulates the result of detecting a barcode in an image. This includes the raw - * matrix of black/white pixels corresponding to the barcode, and possibly points of interest - * in the image, like the location of finder patterns or corners of the barcode in the image.

- * - * @author Sean Owen - */ -public class DetectorRXingResult { - - private final BitMatrix bits; - private final RXingResultPoint[] points; - - public DetectorRXingResult(BitMatrix bits, RXingResultPoint[] points) { - this.bits = bits; - this.points = points; - } - - public final BitMatrix getBits() { - return bits; - } - - public final RXingResultPoint[] getPoints() { - return points; - } - -} \ No newline at end of file diff --git a/src/common/mod.rs b/src/common/mod.rs index 7633bf8..735ae31 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -7,6 +7,7 @@ use std::{any::Any, collections::HashMap}; use crate::exceptions::IllegalArgumentException; use crate::DecodeHintType; +use crate::RXingResultPoint; use encoding::Encoding; /* @@ -52,9 +53,9 @@ pub struct StringUtils { } const PLATFORM_DEFAULT_ENCODING: dyn Encoding = encoding::all::UTF_8; -const SHIFT_JIS_CHARSET: Encoding = encoding::label::encoding_from_whatwg_label("SJIS"); -const GB2312_CHARSET: Encoding = encoding::label::encoding_from_whatwg_label("GB2312"); -const EUC_JP: Encoding = encoding::label::encoding_from_whatwg_label("EUC_JP"); +const SHIFT_JIS_CHARSET: dyn Encoding = encoding::label::encoding_from_whatwg_label("SJIS"); +const GB2312_CHARSET: dyn Encoding = encoding::label::encoding_from_whatwg_label("GB2312"); +const EUC_JP: dyn Encoding = encoding::label::encoding_from_whatwg_label("EUC_JP"); const ASSUME_SHIFT_JIS: bool = false; static SHIFT_JIS: &'static str = "SJIS"; static GB2312: &'static str = "GB2312"; @@ -663,3 +664,52 @@ impl fmt::Display for BitArray { write!(f, "{}", _str) } } + +/* + * Copyright 2007 ZXing authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// package com.google.zxing.common; + +// import com.google.zxing.RXingResultPoint; + +/** + *

Encapsulates the result of detecting a barcode in an image. This includes the raw + * matrix of black/white pixels corresponding to the barcode, and possibly points of interest + * in the image, like the location of finder patterns or corners of the barcode in the image.

+ * + * @author Sean Owen + */ +pub struct DetectorRXingResult { + bits: BitMatrix, + points: Vec, +} + +impl DetectorRXingResult { + pub fn new(bits: BitMatrix, points: Vec) -> Self { + Self { + bits: bits, + points: points, + } + } + + pub fn getBits(&self) -> BitMatrix { + return self.bits; + } + + pub fn getPoints(&self) -> Vec { + return self.points; + } +}