mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 04:42:35 +00:00
port of the c++ datamatrix detector
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
|
||||
use std::fmt;
|
||||
|
||||
use crate::Exceptions;
|
||||
use crate::{Exceptions, RXingResultPoint};
|
||||
|
||||
use super::BitArray;
|
||||
|
||||
@@ -207,6 +207,12 @@ impl BitMatrix {
|
||||
((self.bits[offset] >> (x & 0x1f)) & 1) != 0
|
||||
}
|
||||
|
||||
pub fn get_point(&self, point: &RXingResultPoint) -> bool {
|
||||
self.get(point.x as u32, point.y as u32)
|
||||
// let offset = self.get_offset(point.y as u32, point.x as u32);
|
||||
// ((self.bits[offset] >> (x & 0x1f)) & 1) != 0
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn get_offset(&self, y: u32, x: u32) -> usize {
|
||||
y as usize * self.row_size + (x as usize / 32)
|
||||
@@ -659,6 +665,13 @@ impl BitMatrix {
|
||||
}
|
||||
new_bm
|
||||
}
|
||||
|
||||
pub fn isIn(&self, p: &RXingResultPoint, b: i32) -> bool {
|
||||
b as f32 <= p.x
|
||||
&& p.x < self.getWidth() as f32 - b as f32
|
||||
&& b as f32 <= p.y
|
||||
&& p.y < self.getHeight() as f32 - b as f32
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for BitMatrix {
|
||||
|
||||
Reference in New Issue
Block a user