"Fossies" - the Fresh Open Source Software Archive  

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

DataMatrixWriter.java  (zxing-zxing-3.4.1):DataMatrixWriter.java  (zxing-zxing-3.5.0)
skipping to change at line 27 skipping to change at line 27
package com.google.zxing.datamatrix; package com.google.zxing.datamatrix;
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.common.BitMatrix; import com.google.zxing.common.BitMatrix;
import com.google.zxing.datamatrix.encoder.DefaultPlacement; import com.google.zxing.datamatrix.encoder.DefaultPlacement;
import com.google.zxing.Dimension; import com.google.zxing.Dimension;
import com.google.zxing.datamatrix.encoder.ErrorCorrection; import com.google.zxing.datamatrix.encoder.ErrorCorrection;
import com.google.zxing.datamatrix.encoder.HighLevelEncoder; import com.google.zxing.datamatrix.encoder.HighLevelEncoder;
import com.google.zxing.datamatrix.encoder.MinimalEncoder;
import com.google.zxing.datamatrix.encoder.SymbolInfo; import com.google.zxing.datamatrix.encoder.SymbolInfo;
import com.google.zxing.datamatrix.encoder.SymbolShapeHint; import com.google.zxing.datamatrix.encoder.SymbolShapeHint;
import com.google.zxing.qrcode.encoder.ByteMatrix; import com.google.zxing.qrcode.encoder.ByteMatrix;
import java.util.Map; import java.util.Map;
import java.nio.charset.Charset;
/** /**
* This object renders a Data Matrix code as a BitMatrix 2D array of greyscale v alues. * This object renders a Data Matrix code as a BitMatrix 2D array of greyscale v alues.
* *
* @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.
*/ */
public final class DataMatrixWriter implements Writer { public final class DataMatrixWriter implements Writer {
@Override @Override
skipping to change at line 83 skipping to change at line 85
minSize = requestedMinSize; minSize = requestedMinSize;
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
Dimension requestedMaxSize = (Dimension) hints.get(EncodeHintType.MAX_SIZE ); Dimension requestedMaxSize = (Dimension) hints.get(EncodeHintType.MAX_SIZE );
if (requestedMaxSize != null) { if (requestedMaxSize != null) {
maxSize = requestedMaxSize; maxSize = requestedMaxSize;
} }
} }
//1. step: Data encodation //1. step: Data encodation
String encoded = HighLevelEncoder.encodeHighLevel(contents, shape, minSize, String encoded;
maxSize);
boolean hasCompactionHint = hints != null && hints.containsKey(EncodeHintTyp
e.DATA_MATRIX_COMPACT) &&
Boolean.parseBoolean(hints.get(EncodeHintType.DATA_MATRIX_COMPACT).toStr
ing());
if (hasCompactionHint) {
boolean hasGS1FormatHint = hints.containsKey(EncodeHintType.GS1_FORMAT) &&
Boolean.parseBoolean(hints.get(EncodeHintType.GS1_FORMAT).toString());
Charset charset = null;
boolean hasEncodingHint = hints.containsKey(EncodeHintType.CHARACTER_SET);
if (hasEncodingHint) {
charset = Charset.forName(hints.get(EncodeHintType.CHARACTER_SET).toStri
ng());
}
encoded = MinimalEncoder.encodeHighLevel(contents, charset, hasGS1FormatHi
nt ? 0x1D : -1, shape);
} else {
boolean hasForceC40Hint = hints != null && hints.containsKey(EncodeHintTyp
e.FORCE_C40) &&
Boolean.parseBoolean(hints.get(EncodeHintType.FORCE_C40).toString());
encoded = HighLevelEncoder.encodeHighLevel(contents, shape, minSize, maxSi
ze, hasForceC40Hint);
}
SymbolInfo symbolInfo = SymbolInfo.lookup(encoded.length(), shape, minSize, maxSize, true); SymbolInfo symbolInfo = SymbolInfo.lookup(encoded.length(), shape, minSize, maxSize, true);
//2. step: ECC generation //2. step: ECC generation
String codewords = ErrorCorrection.encodeECC200(encoded, symbolInfo); String codewords = ErrorCorrection.encodeECC200(encoded, symbolInfo);
//3. step: Module placement in Matrix //3. step: Module placement in Matrix
DefaultPlacement placement = new DefaultPlacement(codewords, symbolInfo.getS DefaultPlacement placement =
ymbolDataWidth(), symbolInfo.getSymbolDataHeight()); new DefaultPlacement(codewords, symbolInfo.getSymbolDataWidth(), symbolI
nfo.getSymbolDataHeight());
placement.place(); placement.place();
//4. step: low-level encoding //4. step: low-level encoding
return encodeLowLevel(placement, symbolInfo, width, height); return encodeLowLevel(placement, symbolInfo, width, height);
} }
/** /**
* Encode the given symbol info to a bit matrix. * Encode the given symbol info to a bit matrix.
* *
* @param placement The DataMatrix placement. * @param placement The DataMatrix placement.
 End of changes. 4 change blocks. 
4 lines changed or deleted 31 lines changed or added

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