DetectorRXingResult

This commit is contained in:
Henry Schimke
2022-08-24 16:53:02 -05:00
parent 353a092f57
commit c0c40abc9c
2 changed files with 53 additions and 49 deletions

View File

@@ -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;
/**
* <p>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.</p>
*
* @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;
}
}

View File

@@ -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;
/**
* <p>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.</p>
*
* @author Sean Owen
*/
pub struct DetectorRXingResult {
bits: BitMatrix,
points: Vec<RXingResultPoint>,
}
impl DetectorRXingResult {
pub fn new(bits: BitMatrix, points: Vec<RXingResultPoint>) -> Self {
Self {
bits: bits,
points: points,
}
}
pub fn getBits(&self) -> BitMatrix {
return self.bits;
}
pub fn getPoints(&self) -> Vec<RXingResultPoint> {
return self.points;
}
}