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