mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
fixed various bugs with encoding qrcodes
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
*
|
||||
* @author qwandor@google.com (Andrew Walbran)
|
||||
*/
|
||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||
pub struct Dimensions {
|
||||
minCols: usize,
|
||||
maxCols: usize,
|
||||
|
||||
@@ -19,7 +19,8 @@ use std::{collections::HashMap, path::PathBuf};
|
||||
use image::DynamicImage;
|
||||
|
||||
use crate::{
|
||||
common::BitMatrix, qrcode::QRCodeWriter, BarcodeFormat, EncodeHintType, EncodeHintValue, Writer,
|
||||
common::BitMatrix, qrcode::QRCodeWriter, BarcodeFormat, DecodeHintType, DecodeHintValue,
|
||||
EncodeHintType, EncodeHintValue, Writer,
|
||||
};
|
||||
|
||||
use super::decoder::ErrorCorrectionLevel;
|
||||
|
||||
@@ -1052,7 +1052,14 @@ impl RXingResultNode {
|
||||
.encode_string(
|
||||
// &self.stringToEncode[self.fromPosition as usize
|
||||
// ..(self.fromPosition + self.characterLength as usize)],
|
||||
self.stringToEncode.get(self.fromPosition).unwrap(),
|
||||
// self.stringToEncode.get(self.fromPosition).unwrap(),
|
||||
&(self
|
||||
.stringToEncode
|
||||
.iter()
|
||||
.skip(self.fromPosition)
|
||||
.take(self.characterLength as usize)
|
||||
.map(|s| s.as_str())
|
||||
.collect::<String>()),
|
||||
self.charsetEncoderIndex,
|
||||
)
|
||||
.len() as u32
|
||||
@@ -1080,7 +1087,13 @@ impl RXingResultNode {
|
||||
encoder::appendBytes(
|
||||
// &self.stringToEncode[self.fromPosition as usize
|
||||
// ..(self.fromPosition + self.characterLength as usize)],
|
||||
self.stringToEncode.get(self.fromPosition).unwrap(),
|
||||
&(self
|
||||
.stringToEncode
|
||||
.iter()
|
||||
.skip(self.fromPosition)
|
||||
.take(self.characterLength as usize)
|
||||
.map(|s| s.as_str())
|
||||
.collect::<String>()), //self.stringToEncode.get(self.fromPosition).unwrap(),
|
||||
self.mode,
|
||||
bits,
|
||||
self.encoders.getCharset(self.charsetEncoderIndex),
|
||||
|
||||
Reference in New Issue
Block a user