mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 12:22:34 +00:00
reorganize some impl blocks
This commit is contained in:
61
src/common/cpp_essentials/base_extentions/bitmatrix.rs
Normal file
61
src/common/cpp_essentials/base_extentions/bitmatrix.rs
Normal file
@@ -0,0 +1,61 @@
|
||||
use crate::common::BitMatrix;
|
||||
use crate::common::Result;
|
||||
use crate::point;
|
||||
|
||||
impl BitMatrix {
|
||||
pub fn Deflate(
|
||||
&self,
|
||||
width: u32,
|
||||
height: u32,
|
||||
top: f32,
|
||||
left: f32,
|
||||
subSampling: f32,
|
||||
) -> Result<Self> {
|
||||
let mut result = BitMatrix::new(width, height)?;
|
||||
|
||||
for y in 0..result.height() {
|
||||
// for (int y = 0; y < result.height(); y++) {
|
||||
let yOffset = top + y as f32 * subSampling;
|
||||
for x in 0..result.width() {
|
||||
// for (int x = 0; x < result.width(); x++) {
|
||||
if (self.get_point(point(left + x as f32 * subSampling, yOffset))) {
|
||||
result.set(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
pub fn findBoundingBox(
|
||||
&self,
|
||||
left: u32,
|
||||
top: u32,
|
||||
width: u32,
|
||||
height: u32,
|
||||
minSize: u32,
|
||||
) -> (bool, u32, u32, u32, u32) {
|
||||
todo!()
|
||||
// let right;
|
||||
// let bottom;
|
||||
// if (!self.getTopLeftOnBitWithPosition(left, top) || !self.getBottomRightOnBitWithPosition(right, bottom) || bottom - top + 1 < minSize)
|
||||
// {return false;}
|
||||
|
||||
// for (int y = top; y <= bottom; y++ ) {
|
||||
// for (int x = 0; x < left; ++x)
|
||||
// if (get(x, y)) {
|
||||
// left = x;
|
||||
// break;
|
||||
// }
|
||||
// for (int x = _width-1; x > right; x--)
|
||||
// if (get(x, y)) {
|
||||
// right = x;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// width = right - left + 1;
|
||||
// height = bottom - top + 1;
|
||||
// return width >= minSize && height >= minSize;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user