mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 12:22:34 +00:00
qrcode encoder pass
This commit is contained in:
@@ -60,6 +60,15 @@ impl ErrorCorrectionLevel {
|
||||
ErrorCorrectionLevel::H => 0x02,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_ordinal(&self) -> u8 {
|
||||
match self {
|
||||
ErrorCorrectionLevel::L => 0,
|
||||
ErrorCorrectionLevel::M => 1,
|
||||
ErrorCorrectionLevel::Q => 2,
|
||||
ErrorCorrectionLevel::H => 3,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<u8> for ErrorCorrectionLevel {
|
||||
|
||||
@@ -90,7 +90,7 @@ impl Version {
|
||||
}
|
||||
|
||||
pub fn getECBlocksForLevel(&self, ecLevel: ErrorCorrectionLevel) -> &ECBlocks {
|
||||
&self.ecBlocks[ecLevel.get_value() as usize]
|
||||
&self.ecBlocks[ecLevel.get_ordinal() as usize]
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user