"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/main/java/com/google/zxing/aztec/AztecWriter.java" between
zxing-zxing-3.4.1.tar.gz and zxing-zxing-3.5.0.tar.gz

About: ZXing ("zebra crossing") is a multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages. Info: Project is in maintenance mode (no active development).

AztecWriter.java  (zxing-zxing-3.4.1):AztecWriter.java  (zxing-zxing-3.5.0)
skipping to change at line 27 skipping to change at line 27
package com.google.zxing.aztec; package com.google.zxing.aztec;
import com.google.zxing.BarcodeFormat; import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType; import com.google.zxing.EncodeHintType;
import com.google.zxing.Writer; import com.google.zxing.Writer;
import com.google.zxing.aztec.encoder.AztecCode; import com.google.zxing.aztec.encoder.AztecCode;
import com.google.zxing.aztec.encoder.Encoder; import com.google.zxing.aztec.encoder.Encoder;
import com.google.zxing.common.BitMatrix; import com.google.zxing.common.BitMatrix;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Map; import java.util.Map;
/** /**
* Renders an Aztec code as a {@link BitMatrix}. * Renders an Aztec code as a {@link BitMatrix}.
*/ */
public final class AztecWriter implements Writer { public final class AztecWriter implements Writer {
@Override @Override
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height) { public BitMatrix encode(String contents, BarcodeFormat format, int width, int height) {
return encode(contents, format, width, height, null); return encode(contents, format, width, height, null);
} }
@Override @Override
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) { public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) {
Charset charset = StandardCharsets.ISO_8859_1; Charset charset = null; // Do not add any ECI code by default
int eccPercent = Encoder.DEFAULT_EC_PERCENT; int eccPercent = Encoder.DEFAULT_EC_PERCENT;
int layers = Encoder.DEFAULT_AZTEC_LAYERS; int layers = Encoder.DEFAULT_AZTEC_LAYERS;
if (hints != null) { if (hints != null) {
if (hints.containsKey(EncodeHintType.CHARACTER_SET)) { if (hints.containsKey(EncodeHintType.CHARACTER_SET)) {
charset = Charset.forName(hints.get(EncodeHintType.CHARACTER_SET).toStri ng()); charset = Charset.forName(hints.get(EncodeHintType.CHARACTER_SET).toStri ng());
} }
if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) { if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
eccPercent = Integer.parseInt(hints.get(EncodeHintType.ERROR_CORRECTION) .toString()); eccPercent = Integer.parseInt(hints.get(EncodeHintType.ERROR_CORRECTION) .toString());
} }
if (hints.containsKey(EncodeHintType.AZTEC_LAYERS)) { if (hints.containsKey(EncodeHintType.AZTEC_LAYERS)) {
skipping to change at line 65 skipping to change at line 64
} }
return encode(contents, format, width, height, charset, eccPercent, layers); return encode(contents, format, width, height, charset, eccPercent, layers);
} }
private static BitMatrix encode(String contents, BarcodeFormat format, private static BitMatrix encode(String contents, BarcodeFormat format,
int width, int height, int width, int height,
Charset charset, int eccPercent, int layers) { Charset charset, int eccPercent, int layers) {
if (format != BarcodeFormat.AZTEC) { if (format != BarcodeFormat.AZTEC) {
throw new IllegalArgumentException("Can only encode AZTEC, but got " + for mat); throw new IllegalArgumentException("Can only encode AZTEC, but got " + for mat);
} }
AztecCode aztec = Encoder.encode(contents.getBytes(charset), eccPercent, lay ers); AztecCode aztec = Encoder.encode(contents, eccPercent, layers, charset);
return renderResult(aztec, width, height); return renderResult(aztec, width, height);
} }
private static BitMatrix renderResult(AztecCode code, int width, int height) { private static BitMatrix renderResult(AztecCode code, int width, int height) {
BitMatrix input = code.getMatrix(); BitMatrix input = code.getMatrix();
if (input == null) { if (input == null) {
throw new IllegalStateException(); throw new IllegalStateException();
} }
int inputWidth = input.getWidth(); int inputWidth = input.getWidth();
int inputHeight = input.getHeight(); int inputHeight = input.getHeight();
 End of changes. 3 change blocks. 
3 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)