"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.0.tar.gz and zxing-zxing-3.4.1.tar.gz

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

PDF417Writer.java  (zxing-zxing-3.4.0):PDF417Writer.java  (zxing-zxing-3.4.1)
skipping to change at line 63 skipping to change at line 63
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;
if (hints != null) { if (hints != null) {
if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) { if (hints.containsKey(EncodeHintType.PDF417_COMPACT)) {
encoder.setCompact(Boolean.valueOf(hints.get(EncodeHintType.PDF417_COMPA CT).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);
encoder.setDimensions(dimensions.getMaxCols(), encoder.setDimensions(dimensions.getMaxCols(),
dimensions.getMinCols(), dimensions.getMinCols(),
dimensions.getMaxRows(), dimensions.getMaxRows(),
dimensions.getMinRows()); dimensions.getMinRows());
skipping to change at line 119 skipping to change at line 119
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;
int scaleY = height / originalScale.length; int scaleY = height / originalScale.length;
int scale = Math.min(scaleX, scaleY);
int scale;
if (scaleX < scaleY) {
scale = scaleX;
} else {
scale = scaleY;
}
if (scale > 1) { if (scale > 1) {
byte[][] scaledMatrix = byte[][] scaledMatrix =
encoder.getBarcodeMatrix().getScaledMatrix(scale, scale * aspectRatio) ; encoder.getBarcodeMatrix().getScaledMatrix(scale, scale * aspectRatio) ;
if (rotated) { if (rotated) {
scaledMatrix = rotateArray(scaledMatrix); scaledMatrix = rotateArray(scaledMatrix);
} }
return bitMatrixFromBitArray(scaledMatrix, margin); return bitMatrixFromBitArray(scaledMatrix, margin);
} }
return bitMatrixFromBitArray(originalScale, margin); return bitMatrixFromBitArray(originalScale, margin);
 End of changes. 2 change blocks. 
8 lines changed or deleted 2 lines changed or added

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