mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
default for boxable writers
This commit is contained in:
@@ -28,6 +28,7 @@ use super::encoder::{encoder, AztecCode};
|
|||||||
/**
|
/**
|
||||||
* Renders an Aztec code as a {@link BitMatrix}.
|
* Renders an Aztec code as a {@link BitMatrix}.
|
||||||
*/
|
*/
|
||||||
|
#[derive(Default)]
|
||||||
pub struct AztecWriter;
|
pub struct AztecWriter;
|
||||||
|
|
||||||
impl Writer for AztecWriter {
|
impl Writer for AztecWriter {
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ use super::encoder::error_correction;
|
|||||||
* @author dswitkin@google.com (Daniel Switkin)
|
* @author dswitkin@google.com (Daniel Switkin)
|
||||||
* @author Guillaume Le Biller Added to zxing lib.
|
* @author Guillaume Le Biller Added to zxing lib.
|
||||||
*/
|
*/
|
||||||
|
#[derive(Default)]
|
||||||
pub struct DataMatrixWriter;
|
pub struct DataMatrixWriter;
|
||||||
|
|
||||||
impl Writer for DataMatrixWriter {
|
impl Writer for DataMatrixWriter {
|
||||||
|
|||||||
@@ -23,8 +23,9 @@ use crate::{
|
|||||||
Code128Writer, Code39Writer, Code93Writer, EAN13Writer, EAN8Writer, ITFWriter, UPCAWriter,
|
Code128Writer, Code39Writer, Code93Writer, EAN13Writer, EAN8Writer, ITFWriter, UPCAWriter,
|
||||||
UPCEWriter,
|
UPCEWriter,
|
||||||
},
|
},
|
||||||
|
pdf417::PDF417Writer,
|
||||||
qrcode::QRCodeWriter,
|
qrcode::QRCodeWriter,
|
||||||
BarcodeFormat, Exceptions, Writer, pdf417::PDF417Writer,
|
BarcodeFormat, Exceptions, Writer,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,19 +56,19 @@ impl Writer for MultiFormatWriter {
|
|||||||
hints: &crate::EncodingHintDictionary,
|
hints: &crate::EncodingHintDictionary,
|
||||||
) -> Result<crate::common::BitMatrix, crate::Exceptions> {
|
) -> Result<crate::common::BitMatrix, crate::Exceptions> {
|
||||||
let writer: Box<dyn Writer> = match format {
|
let writer: Box<dyn Writer> = match format {
|
||||||
BarcodeFormat::EAN_8 => Box::new(EAN8Writer::default()),
|
BarcodeFormat::EAN_8 => Box::<EAN8Writer>::default(),
|
||||||
BarcodeFormat::UPC_E => Box::new(UPCEWriter::default()),
|
BarcodeFormat::UPC_E => Box::<UPCEWriter>::default(),
|
||||||
BarcodeFormat::EAN_13 => Box::new(EAN13Writer::default()),
|
BarcodeFormat::EAN_13 => Box::<EAN13Writer>::default(),
|
||||||
BarcodeFormat::UPC_A => Box::new(UPCAWriter::default()),
|
BarcodeFormat::UPC_A => Box::<UPCAWriter>::default(),
|
||||||
BarcodeFormat::QR_CODE => Box::new(QRCodeWriter {}),
|
BarcodeFormat::QR_CODE => Box::<QRCodeWriter>::default(),
|
||||||
BarcodeFormat::CODE_39 => Box::new(Code39Writer::default()),
|
BarcodeFormat::CODE_39 => Box::<Code39Writer>::default(),
|
||||||
BarcodeFormat::CODE_93 => Box::new(Code93Writer::default()),
|
BarcodeFormat::CODE_93 => Box::<Code93Writer>::default(),
|
||||||
BarcodeFormat::CODE_128 => Box::new(Code128Writer::default()),
|
BarcodeFormat::CODE_128 => Box::<Code128Writer>::default(),
|
||||||
BarcodeFormat::ITF => Box::new(ITFWriter::default()),
|
BarcodeFormat::ITF => Box::<ITFWriter>::default(),
|
||||||
BarcodeFormat::PDF_417 => Box::new(PDF417Writer::default()),
|
BarcodeFormat::PDF_417 => Box::<PDF417Writer>::default(),
|
||||||
BarcodeFormat::CODABAR => Box::new(Code128Writer::default()),
|
BarcodeFormat::CODABAR => Box::<Code128Writer>::default(),
|
||||||
BarcodeFormat::DATA_MATRIX => Box::new(DataMatrixWriter {}),
|
BarcodeFormat::DATA_MATRIX => Box::<DataMatrixWriter>::default(),
|
||||||
BarcodeFormat::AZTEC => Box::new(AztecWriter {}),
|
BarcodeFormat::AZTEC => Box::<AztecWriter>::default(),
|
||||||
_ => {
|
_ => {
|
||||||
return Err(Exceptions::IllegalArgumentException(format!(
|
return Err(Exceptions::IllegalArgumentException(format!(
|
||||||
"No encoder available for format {:?}",
|
"No encoder available for format {:?}",
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ const QUIET_ZONE_SIZE: i32 = 4;
|
|||||||
*
|
*
|
||||||
* @author dswitkin@google.com (Daniel Switkin)
|
* @author dswitkin@google.com (Daniel Switkin)
|
||||||
*/
|
*/
|
||||||
|
#[derive(Default)]
|
||||||
pub struct QRCodeWriter; // {
|
pub struct QRCodeWriter; // {
|
||||||
|
|
||||||
// private static final int QUIET_ZONE_SIZE = 4;
|
// private static final int QUIET_ZONE_SIZE = 4;
|
||||||
|
|||||||
Reference in New Issue
Block a user