rss_14 ported but does not pass integration

This commit is contained in:
Henry Schimke
2022-12-13 17:39:12 -06:00
parent 63252a6297
commit ab4dab420b
17 changed files with 1138 additions and 935 deletions

View File

@@ -0,0 +1,65 @@
/*
* Copyright 2009 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.
*/
use std::hash::Hash;
use crate::RXingResultPoint;
/**
* Encapsulates an RSS barcode finder pattern, including its start/end position and row.
*/
pub struct FinderPattern {
value: u32,
startEnd: [usize; 2],
resultPoints: Vec<RXingResultPoint>,
}
impl FinderPattern {
pub fn new(value: u32, startEnd: [usize; 2], start: usize, end: usize, rowNumber: u32) -> Self {
Self {
value,
startEnd,
resultPoints: vec![
RXingResultPoint::new(start as f32, rowNumber as f32),
RXingResultPoint::new(end as f32, rowNumber as f32),
],
}
}
pub fn getValue(&self) -> u32 {
self.value
}
pub fn getStartEnd(&self) -> &[usize] {
&self.startEnd
}
pub fn getRXingResultPoints(&self) -> &[RXingResultPoint] {
&self.resultPoints
}
}
impl PartialEq for FinderPattern {
fn eq(&self, other: &Self) -> bool {
self.value == other.value
}
}
impl Eq for FinderPattern {}
impl Hash for FinderPattern {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.value.hash(state);
}
}