mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-28 05:12:34 +00:00
v0.1.4
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rxing"
|
name = "rxing"
|
||||||
version = "0.1.3"
|
version = "0.1.4"
|
||||||
description="A rust port of the zxing barcode library."
|
description="A rust port of the zxing barcode library."
|
||||||
license="Apache-2.0"
|
license="Apache-2.0"
|
||||||
repository="https://github.com/hschimke/rxing"
|
repository="https://github.com/hschimke/rxing"
|
||||||
@@ -20,8 +20,8 @@ encoding = "0.2"
|
|||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
urlencoding = "2.1.2"
|
urlencoding = "2.1.2"
|
||||||
uriparse = "0.6.4"
|
uriparse = "0.6.4"
|
||||||
chrono = "0.4"
|
chrono = "0.4.23"
|
||||||
chrono-tz = "0.4"
|
chrono-tz = "0.8"
|
||||||
image = {version = "0.24", optional = true}
|
image = {version = "0.24", optional = true}
|
||||||
imageproc = {version = "0.23.0", optional = true}
|
imageproc = {version = "0.23.0", optional = true}
|
||||||
unicode-segmentation = "1.10.0"
|
unicode-segmentation = "1.10.0"
|
||||||
|
|||||||
@@ -61,3 +61,6 @@ fn main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Latest Release Notes
|
||||||
|
v0.1.4 -> Dramatically improve performance for MultiFormatReader and for multiple barcode detection.
|
||||||
@@ -221,14 +221,23 @@ impl LuminanceSource for BufferedImageLuminanceSource {
|
|||||||
width: usize,
|
width: usize,
|
||||||
height: usize,
|
height: usize,
|
||||||
) -> Result<Box<dyn LuminanceSource>, crate::exceptions::Exceptions> {
|
) -> Result<Box<dyn LuminanceSource>, crate::exceptions::Exceptions> {
|
||||||
return Ok(Box::new(BufferedImageLuminanceSource::with_details(
|
// Ok(Box::new(BufferedImageLuminanceSource::with_details(
|
||||||
self.image
|
// self.image
|
||||||
|
// .crop_imm(left as u32, top as u32, width as u32, height as u32),
|
||||||
|
// self.left + left as u32,
|
||||||
|
// self.top + top as u32,
|
||||||
|
// width,
|
||||||
|
// height,
|
||||||
|
// )))
|
||||||
|
Ok(Box::new(Self {
|
||||||
|
image: self
|
||||||
|
.image
|
||||||
.crop_imm(left as u32, top as u32, width as u32, height as u32),
|
.crop_imm(left as u32, top as u32, width as u32, height as u32),
|
||||||
self.left + left as u32,
|
|
||||||
self.top + top as u32,
|
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
)));
|
left: self.left + left as u32,
|
||||||
|
top: self.top + top as u32,
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn isRotateSupported(&self) -> bool {
|
fn isRotateSupported(&self) -> bool {
|
||||||
@@ -238,9 +247,17 @@ impl LuminanceSource for BufferedImageLuminanceSource {
|
|||||||
fn rotateCounterClockwise(
|
fn rotateCounterClockwise(
|
||||||
&self,
|
&self,
|
||||||
) -> Result<Box<dyn LuminanceSource>, crate::exceptions::Exceptions> {
|
) -> Result<Box<dyn LuminanceSource>, crate::exceptions::Exceptions> {
|
||||||
Ok(Box::new(BufferedImageLuminanceSource::new(
|
// Ok(Box::new(BufferedImageLuminanceSource::new(
|
||||||
self.image.rotate270(),
|
// self.image.rotate270(),
|
||||||
)))
|
// )))
|
||||||
|
let img = self.image.rotate270();
|
||||||
|
Ok(Box::new(Self {
|
||||||
|
width: img.width() as usize,
|
||||||
|
height: img.height() as usize,
|
||||||
|
image: img,
|
||||||
|
left: 0,
|
||||||
|
top: 0,
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rotateCounterClockwise45(
|
fn rotateCounterClockwise45(
|
||||||
@@ -255,6 +272,13 @@ impl LuminanceSource for BufferedImageLuminanceSource {
|
|||||||
|
|
||||||
let new_img = DynamicImage::from(img);
|
let new_img = DynamicImage::from(img);
|
||||||
|
|
||||||
Ok(Box::new(BufferedImageLuminanceSource::new(new_img)))
|
// Ok(Box::new(BufferedImageLuminanceSource::new(new_img)))
|
||||||
|
Ok(Box::new(Self {
|
||||||
|
width: new_img.width() as usize,
|
||||||
|
height: new_img.height() as usize,
|
||||||
|
image: new_img,
|
||||||
|
left: 0,
|
||||||
|
top: 0,
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,11 +196,12 @@ impl BitArray {
|
|||||||
* Clears all bits (sets to false).
|
* Clears all bits (sets to false).
|
||||||
*/
|
*/
|
||||||
pub fn clear(&mut self) {
|
pub fn clear(&mut self) {
|
||||||
let max = self.bits.len();
|
// let max = self.bits.len();
|
||||||
for i in 0..max {
|
// for i in 0..max {
|
||||||
//for (int i = 0; i < max; i++) {
|
// //for (int i = 0; i < max; i++) {
|
||||||
self.bits[i] = 0;
|
// self.bits[i] = 0;
|
||||||
}
|
// }
|
||||||
|
self.bits.fill(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -212,6 +212,10 @@ impl BitMatrix {
|
|||||||
return Ok(((self.bits[offset] >> (x & 0x1f)) & 1) != 0);
|
return Ok(((self.bits[offset] >> (x & 0x1f)) & 1) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn check_in_bounds(&self, x: u32, y: u32) -> bool {
|
||||||
|
(y as usize * self.row_size + (x as usize / 32)) > self.bits.len()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Sets the given bit to true.</p>
|
* <p>Sets the given bit to true.</p>
|
||||||
*
|
*
|
||||||
@@ -281,11 +285,12 @@ impl BitMatrix {
|
|||||||
* Clears all bits (sets to false).
|
* Clears all bits (sets to false).
|
||||||
*/
|
*/
|
||||||
pub fn clear(&mut self) {
|
pub fn clear(&mut self) {
|
||||||
let max = self.bits.len();
|
// let max = self.bits.len();
|
||||||
for i in 0..max {
|
// for i in 0..max {
|
||||||
//for (int i = 0; i < max; i++) {
|
// //for (int i = 0; i < max; i++) {
|
||||||
self.bits[i] = 0;
|
// self.bits[i] = 0;
|
||||||
}
|
// }
|
||||||
|
self.bits.fill(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ impl MultipleBarcodeReader for QRCodeMultiReader {
|
|||||||
hints: &crate::DecodingHintDictionary,
|
hints: &crate::DecodingHintDictionary,
|
||||||
) -> Result<Vec<crate::RXingResult>, crate::Exceptions> {
|
) -> Result<Vec<crate::RXingResult>, crate::Exceptions> {
|
||||||
let mut results = Vec::new();
|
let mut results = Vec::new();
|
||||||
let detectorRXingResults =
|
let detectorRXingResults = MultiDetector::new(image.getBlackMatrix()).detectMulti(hints)?;
|
||||||
MultiDetector::new(image.getBlackMatrix()).detectMulti(hints)?;
|
|
||||||
for detectorRXingResult in detectorRXingResults {
|
for detectorRXingResult in detectorRXingResults {
|
||||||
let mut proc = || -> Result<(), Exceptions> {
|
let mut proc = || -> Result<(), Exceptions> {
|
||||||
let decoderRXingResult = decoder::decoder::decode_bitmatrix_with_hints(
|
let decoderRXingResult = decoder::decoder::decode_bitmatrix_with_hints(
|
||||||
|
|||||||
@@ -817,7 +817,7 @@ fn adjustCodewordStartColumn(
|
|||||||
return codewordStartColumn;
|
return codewordStartColumn;
|
||||||
}
|
}
|
||||||
correctedStartColumn = (correctedStartColumn as i32 + increment) as u32;
|
correctedStartColumn = (correctedStartColumn as i32 + increment) as u32;
|
||||||
if let Err(_) = image.try_get(correctedStartColumn, imageRow) {
|
if image.check_in_bounds(correctedStartColumn, imageRow) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user