"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/main/java/com/google/zxing/pdf417/PDF417Writer.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).

PDF417Writer.java  (zxing-zxing-3.4.1):PDF417Writer.java  (zxing-zxing-3.5.0)
skipping to change at line 60 skipping to change at line 60
int width, int width,
int height, int height,
Map<EncodeHintType,?> hints) throws WriterException { Map<EncodeHintType,?> hints) throws WriterException {
if (format != BarcodeFormat.PDF_417) { if (format != BarcodeFormat.PDF_417) {
throw new IllegalArgumentException("Can only encode PDF_417, but got " + f ormat); throw new IllegalArgumentException("Can only encode PDF_417, but got " + f ormat);
} }
PDF417 encoder = new PDF417(); PDF417 encoder = new PDF417();
int margin = WHITE_SPACE; int margin = WHITE_SPACE;
int errorCorrectionLevel = DEFAULT_ERROR_CORRECTION_LEVEL; int errorCorrectionLevel = DEFAULT_ERROR_CORRECTION_LEVEL;
boolean autoECI = false;
if (hints != null) { if (hints != null) {
if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) { if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) {
encoder.setCompact(Boolean.parseBoolean(hints.get(EncodeHintType.PDF417_ COMPACT).toString())); encoder.setCompact(Boolean.parseBoolean(hints.get(EncodeHintType.PDF417_ COMPACT).toString()));
} }
if (hints.containsKey(EncodeHintType.PDF417_COMPACTION)) { if (hints.containsKey(EncodeHintType.PDF417_COMPACTION)) {
encoder.setCompaction(Compaction.valueOf(hints.get(EncodeHintType.PDF417 _COMPACTION).toString())); encoder.setCompaction(Compaction.valueOf(hints.get(EncodeHintType.PDF417 _COMPACTION).toString()));
} }
if (hints.containsKey(EncodeHintType.PDF417_DIMENSIONS)) { if (hints.containsKey(EncodeHintType.PDF417_DIMENSIONS)) {
Dimensions dimensions = (Dimensions) hints.get(EncodeHintType.PDF417_DIM ENSIONS); Dimensions dimensions = (Dimensions) hints.get(EncodeHintType.PDF417_DIM ENSIONS);
skipping to change at line 85 skipping to change at line 86
if (hints.containsKey(EncodeHintType.MARGIN)) { if (hints.containsKey(EncodeHintType.MARGIN)) {
margin = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString()); margin = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString());
} }
if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) { if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {
errorCorrectionLevel = Integer.parseInt(hints.get(EncodeHintType.ERROR_C ORRECTION).toString()); errorCorrectionLevel = Integer.parseInt(hints.get(EncodeHintType.ERROR_C ORRECTION).toString());
} }
if (hints.containsKey(EncodeHintType.CHARACTER_SET)) { if (hints.containsKey(EncodeHintType.CHARACTER_SET)) {
Charset encoding = Charset.forName(hints.get(EncodeHintType.CHARACTER_SE T).toString()); Charset encoding = Charset.forName(hints.get(EncodeHintType.CHARACTER_SE T).toString());
encoder.setEncoding(encoding); encoder.setEncoding(encoding);
} }
autoECI = hints.containsKey(EncodeHintType.PDF417_AUTO_ECI) &&
Boolean.parseBoolean(hints.get(EncodeHintType.PDF417_AUTO_ECI).toStrin
g());
} }
return bitMatrixFromEncoder(encoder, contents, errorCorrectionLevel, width, height, margin); return bitMatrixFromEncoder(encoder, contents, errorCorrectionLevel, width, height, margin, autoECI);
} }
@Override @Override
public BitMatrix encode(String contents, public BitMatrix encode(String contents,
BarcodeFormat format, BarcodeFormat format,
int width, int width,
int height) throws WriterException { int height) throws WriterException {
return encode(contents, format, width, height, null); return encode(contents, format, width, height, null);
} }
/** /**
* Takes encoder, accounts for width/height, and retrieves bit matrix * Takes encoder, accounts for width/height, and retrieves bit matrix
*/ */
private static BitMatrix bitMatrixFromEncoder(PDF417 encoder, private static BitMatrix bitMatrixFromEncoder(PDF417 encoder,
String contents, String contents,
int errorCorrectionLevel, int errorCorrectionLevel,
int width, int width,
int height, int height,
int margin) throws WriterExcepti int margin,
on { boolean autoECI) throws WriterEx
encoder.generateBarcodeLogic(contents, errorCorrectionLevel); ception {
encoder.generateBarcodeLogic(contents, errorCorrectionLevel, autoECI);
int aspectRatio = 4; int aspectRatio = 4;
byte[][] originalScale = encoder.getBarcodeMatrix().getScaledMatrix(1, aspec tRatio); byte[][] originalScale = encoder.getBarcodeMatrix().getScaledMatrix(1, aspec tRatio);
boolean rotated = false; boolean rotated = false;
if ((height > width) != (originalScale[0].length < originalScale.length)) { if ((height > width) != (originalScale[0].length < originalScale.length)) {
originalScale = rotateArray(originalScale); originalScale = rotateArray(originalScale);
rotated = true; rotated = true;
} }
int scaleX = width / originalScale[0].length; int scaleX = width / originalScale[0].length;
 End of changes. 4 change blocks. 
4 lines changed or deleted 9 lines changed or added

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