mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 12:22:34 +00:00
prepare for v0.2.18 (wasm)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "rxing"
|
||||
version = "0.2.17"
|
||||
version = "0.2.18"
|
||||
description="A rust port of the zxing barcode library."
|
||||
license="Apache-2.0"
|
||||
repository="https://github.com/hschimke/rxing"
|
||||
@@ -42,3 +42,4 @@ image = ["dep:image", "dep:imageproc"]
|
||||
allow_forced_iso_ied_18004_compliance = []
|
||||
svg_write = ["dep:svg"]
|
||||
svg_read = ["dep:resvg", "image"]
|
||||
wasm_support = ["chrono/wasmbind"]
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use std::{collections::HashMap, time::UNIX_EPOCH};
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::{
|
||||
common::{DecoderRXingResult, DetectorRXingResult},
|
||||
@@ -103,10 +103,7 @@ impl Reader for AztecReader {
|
||||
decoderRXingResult.getNumBits(),
|
||||
points.to_vec(),
|
||||
BarcodeFormat::AZTEC,
|
||||
std::time::SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.expect("Time went backwards")
|
||||
.as_millis(),
|
||||
chrono::Utc::now().timestamp_millis() as u128,
|
||||
);
|
||||
|
||||
let byteSegments = decoderRXingResult.getByteSegments();
|
||||
|
||||
@@ -451,6 +451,7 @@ impl BitMatrixParser {
|
||||
bitMatrix: &BitMatrix,
|
||||
version: VersionRef,
|
||||
) -> Result<BitMatrix, Exceptions> {
|
||||
// dbg!(bitMatrix.to_string());
|
||||
let symbolSizeRows = version.getSymbolSizeRows();
|
||||
let symbolSizeColumns = version.getSymbolSizeColumns();
|
||||
|
||||
@@ -496,3 +497,11 @@ impl BitMatrixParser {
|
||||
Ok(bitMatrixWithoutAlignment)
|
||||
}
|
||||
}
|
||||
|
||||
// const IS_MOSTLY_BLACK_RATIO : f32= 0.5;
|
||||
|
||||
// fn is_mostly_black(array: &[bool]) -> bool {
|
||||
// let array_len = array.len() as f32;
|
||||
// let true_count = array.iter().fold(0, |acc,b| acc + i32::from(*b)) as f32;
|
||||
// (array_len / true_count ) > IS_MOSTLY_BLACK_RATIO
|
||||
// }
|
||||
|
||||
@@ -237,7 +237,7 @@ impl<'a> Detector<'_> {
|
||||
transform: &PerspectiveTransform,
|
||||
dimension: u32,
|
||||
) -> Result<BitMatrix, Exceptions> {
|
||||
let sampler = DefaultGridSampler {};
|
||||
let sampler = DefaultGridSampler::default();
|
||||
sampler.sample_grid(image, dimension, dimension, transform)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,11 +19,7 @@
|
||||
//import java.util.EnumMap;
|
||||
//import java.util.Map;
|
||||
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fmt,
|
||||
time::{SystemTime, UNIX_EPOCH},
|
||||
};
|
||||
use std::{collections::HashMap, fmt};
|
||||
|
||||
use crate::{BarcodeFormat, RXingResultMetadataType, RXingResultMetadataValue, RXingResultPoint};
|
||||
|
||||
@@ -54,10 +50,7 @@ impl RXingResult {
|
||||
rawBytes,
|
||||
resultPoints,
|
||||
format,
|
||||
SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.expect("Time went backwards")
|
||||
.as_millis(),
|
||||
chrono::Utc::now().timestamp_millis() as u128,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user