"Fossies" - the Fresh Open Source Software Archive  

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

PDF417.java  (zxing-zxing-3.4.1):PDF417.java  (zxing-zxing-3.5.0)
skipping to change at line 646 skipping to change at line 646
} }
} }
} }
/** /**
* @param msg message to encode * @param msg message to encode
* @param errorCorrectionLevel PDF417 error correction level to use * @param errorCorrectionLevel PDF417 error correction level to use
* @throws WriterException if the contents cannot be encoded in this format * @throws WriterException if the contents cannot be encoded in this format
*/ */
public void generateBarcodeLogic(String msg, int errorCorrectionLevel) throws WriterException { public void generateBarcodeLogic(String msg, int errorCorrectionLevel) throws WriterException {
generateBarcodeLogic(msg, errorCorrectionLevel, false);
}
/**
* @param msg message to encode
* @param errorCorrectionLevel PDF417 error correction level to use
* @param autoECI automatically insert ECIs if needed
* @throws WriterException if the contents cannot be encoded in this format
*/
public void generateBarcodeLogic(String msg, int errorCorrectionLevel, boolean
autoECI) throws WriterException {
//1. step: High-level encoding //1. step: High-level encoding
int errorCorrectionCodeWords = PDF417ErrorCorrection.getErrorCorrectionCodew ordCount(errorCorrectionLevel); int errorCorrectionCodeWords = PDF417ErrorCorrection.getErrorCorrectionCodew ordCount(errorCorrectionLevel);
String highLevel = PDF417HighLevelEncoder.encodeHighLevel(msg, compaction, e ncoding); String highLevel = PDF417HighLevelEncoder.encodeHighLevel(msg, compaction, e ncoding, autoECI);
int sourceCodeWords = highLevel.length(); int sourceCodeWords = highLevel.length();
int[] dimension = determineDimensions(sourceCodeWords, errorCorrectionCodeWo rds); int[] dimension = determineDimensions(sourceCodeWords, errorCorrectionCodeWo rds);
int cols = dimension[0]; int cols = dimension[0];
int rows = dimension[1]; int rows = dimension[1];
int pad = getNumberOfPadCodewords(sourceCodeWords, errorCorrectionCodeWords, cols, rows); int pad = getNumberOfPadCodewords(sourceCodeWords, errorCorrectionCodeWords, cols, rows);
//2. step: construct data codewords //2. step: construct data codewords
skipping to change at line 716 skipping to change at line 726
// ignore if previous ratio is closer to preferred ratio // ignore if previous ratio is closer to preferred ratio
if (dimension != null && Math.abs(newRatio - PREFERRED_RATIO) > Math.abs(r atio - PREFERRED_RATIO)) { if (dimension != null && Math.abs(newRatio - PREFERRED_RATIO) > Math.abs(r atio - PREFERRED_RATIO)) {
continue; continue;
} }
ratio = newRatio; ratio = newRatio;
dimension = new int[] {cols, rows}; dimension = new int[] {cols, rows};
} }
// Handle case when min values were larger than necessary // Handle case when min values were larger than necessary
if (dimension == null) { if (dimension == null) {
int rows = calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWord int rows = calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords
s, minCols); , minCols);
if (rows < minRows) { if (rows < minRows) {
dimension = new int[]{minCols, minRows}; dimension = new int[]{minCols, minRows};
} }
} }
if (dimension == null) { if (dimension == null) {
throw new WriterException("Unable to fit message in columns"); throw new WriterException("Unable to fit message in columns");
} }
return dimension; return dimension;
} }
/** /**
* Sets max/min row/col values * Sets max/min row/col values
 End of changes. 3 change blocks. 
9 lines changed or deleted 20 lines changed or added

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