mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 21:02:35 +00:00
prepare for v0.2.18 (wasm)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rxing"
|
name = "rxing"
|
||||||
version = "0.2.17"
|
version = "0.2.18"
|
||||||
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"
|
||||||
@@ -42,3 +42,4 @@ image = ["dep:image", "dep:imageproc"]
|
|||||||
allow_forced_iso_ied_18004_compliance = []
|
allow_forced_iso_ied_18004_compliance = []
|
||||||
svg_write = ["dep:svg"]
|
svg_write = ["dep:svg"]
|
||||||
svg_read = ["dep:resvg", "image"]
|
svg_read = ["dep:resvg", "image"]
|
||||||
|
wasm_support = ["chrono/wasmbind"]
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use std::{collections::HashMap, time::UNIX_EPOCH};
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
common::{DecoderRXingResult, DetectorRXingResult},
|
common::{DecoderRXingResult, DetectorRXingResult},
|
||||||
@@ -103,10 +103,7 @@ impl Reader for AztecReader {
|
|||||||
decoderRXingResult.getNumBits(),
|
decoderRXingResult.getNumBits(),
|
||||||
points.to_vec(),
|
points.to_vec(),
|
||||||
BarcodeFormat::AZTEC,
|
BarcodeFormat::AZTEC,
|
||||||
std::time::SystemTime::now()
|
chrono::Utc::now().timestamp_millis() as u128,
|
||||||
.duration_since(UNIX_EPOCH)
|
|
||||||
.expect("Time went backwards")
|
|
||||||
.as_millis(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let byteSegments = decoderRXingResult.getByteSegments();
|
let byteSegments = decoderRXingResult.getByteSegments();
|
||||||
|
|||||||
@@ -451,6 +451,7 @@ impl BitMatrixParser {
|
|||||||
bitMatrix: &BitMatrix,
|
bitMatrix: &BitMatrix,
|
||||||
version: VersionRef,
|
version: VersionRef,
|
||||||
) -> Result<BitMatrix, Exceptions> {
|
) -> Result<BitMatrix, Exceptions> {
|
||||||
|
// dbg!(bitMatrix.to_string());
|
||||||
let symbolSizeRows = version.getSymbolSizeRows();
|
let symbolSizeRows = version.getSymbolSizeRows();
|
||||||
let symbolSizeColumns = version.getSymbolSizeColumns();
|
let symbolSizeColumns = version.getSymbolSizeColumns();
|
||||||
|
|
||||||
@@ -496,3 +497,11 @@ impl BitMatrixParser {
|
|||||||
Ok(bitMatrixWithoutAlignment)
|
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,
|
transform: &PerspectiveTransform,
|
||||||
dimension: u32,
|
dimension: u32,
|
||||||
) -> Result<BitMatrix, Exceptions> {
|
) -> Result<BitMatrix, Exceptions> {
|
||||||
let sampler = DefaultGridSampler {};
|
let sampler = DefaultGridSampler::default();
|
||||||
sampler.sample_grid(image, dimension, dimension, transform)
|
sampler.sample_grid(image, dimension, dimension, transform)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,7 @@
|
|||||||
//import java.util.EnumMap;
|
//import java.util.EnumMap;
|
||||||
//import java.util.Map;
|
//import java.util.Map;
|
||||||
|
|
||||||
use std::{
|
use std::{collections::HashMap, fmt};
|
||||||
collections::HashMap,
|
|
||||||
fmt,
|
|
||||||
time::{SystemTime, UNIX_EPOCH},
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{BarcodeFormat, RXingResultMetadataType, RXingResultMetadataValue, RXingResultPoint};
|
use crate::{BarcodeFormat, RXingResultMetadataType, RXingResultMetadataValue, RXingResultPoint};
|
||||||
|
|
||||||
@@ -54,10 +50,7 @@ impl RXingResult {
|
|||||||
rawBytes,
|
rawBytes,
|
||||||
resultPoints,
|
resultPoints,
|
||||||
format,
|
format,
|
||||||
SystemTime::now()
|
chrono::Utc::now().timestamp_millis() as u128,
|
||||||
.duration_since(UNIX_EPOCH)
|
|
||||||
.expect("Time went backwards")
|
|
||||||
.as_millis(),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user