public static final BarcodeFormat QR_CODE = new BarcodeFormat("QR_CODE");
/** DataMatrix 2D barcode format. */
- public static final BarcodeFormat DATAMATRIX = new BarcodeFormat("DATAMATRIX");
+ public static final BarcodeFormat DATA_MATRIX = new BarcodeFormat("DATA_MATRIX");
/** UPC-E 1D format. */
public static final BarcodeFormat UPC_E = new BarcodeFormat("UPC_E");
/** Code 93 1D format. */
public static final BarcodeFormat CODE_93 = new BarcodeFormat("CODE_93");
-
+
/** CODABAR 1D format. */
public static final BarcodeFormat CODABAR = new BarcodeFormat("CODABAR");
/** PDF417 format. */
public static final BarcodeFormat PDF417 = new BarcodeFormat("PDF417");
-
+
/** RSS EXPANDED */
public static final BarcodeFormat RSS_EXPANDED = new BarcodeFormat("RSS_EXPANDED");
formats.contains(BarcodeFormat.CODE_93) ||
formats.contains(BarcodeFormat.CODE_128) ||
formats.contains(BarcodeFormat.ITF) ||
- formats.contains(BarcodeFormat.RSS14) ||
+ formats.contains(BarcodeFormat.RSS14) ||
formats.contains(BarcodeFormat.RSS_EXPANDED);
// Put 1D readers upfront in "normal" mode
if (addOneDReader && !tryHarder) {
if (formats.contains(BarcodeFormat.QR_CODE)) {
readers.addElement(new QRCodeReader());
}
- if (formats.contains(BarcodeFormat.DATAMATRIX)) {
+ if (formats.contains(BarcodeFormat.DATA_MATRIX)) {
readers.addElement(new DataMatrixReader());
}
if (formats.contains(BarcodeFormat.PDF417)) {
readers.addElement(new MultiFormatOneDReader(hints));
}
readers.addElement(new QRCodeReader());
-
+
// TODO re-enable once Data Matrix is ready
// readers.addElement(new DataMatrixReader());
-
+
// TODO: Enable once PDF417 has passed QA
//readers.addElement(new PDF417Reader());
-
+
if (tryHarder) {
readers.addElement(new MultiFormatOneDReader(hints));
}
public final class DataMatrixReader implements Reader {
private static final ResultPoint[] NO_POINTS = new ResultPoint[0];
-
+
private final Decoder decoder = new Decoder();
/**
decoderResult = decoder.decode(detectorResult.getBits());
points = detectorResult.getPoints();
}
- Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.DATAMATRIX);
+ Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points,
+ BarcodeFormat.DATA_MATRIX);
if (decoderResult.getByteSegments() != null) {
result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, decoderResult.getByteSegments());
}
* around it. This is a specialized method that works exceptionally fast in this special
* case.
*
- * @see com.google.zxing.qrcode.QRCodeReader#extractPureBits(BitMatrix)
+ * @see com.google.zxing.qrcode.QRCodeReader#extractPureBits(BitMatrix)
*/
private static BitMatrix extractPureBits(BitMatrix image) throws NotFoundException {
int dimension = 2 + ((rowEndOfSymbol - x) / moduleSize);
y += moduleSize;
-
+
// Push in the "border" by half the module width so that we start
// sampling in the middle of the module. Just in case the image is a
// little off, this will help recover.
public DataMatrixBlackBox1TestCase() {
// TODO use MultiFormatReader here once Data Matrix decoder is done
- super("test/data/blackbox/datamatrix-1", new DataMatrixReader(), BarcodeFormat.DATAMATRIX);
+ super("test/data/blackbox/datamatrix-1", new DataMatrixReader(), BarcodeFormat.DATA_MATRIX);
addTest(7, 7, 0.0f);
addTest(7, 7, 90.0f);
addTest(6, 6, 180.0f);
public DataMatrixBlackBox2TestCase() {
// TODO use MultiFormatReader here once Data Matrix decoder is done
- super("test/data/blackbox/datamatrix-2", new DataMatrixReader(), BarcodeFormat.DATAMATRIX);
+ super("test/data/blackbox/datamatrix-2", new DataMatrixReader(), BarcodeFormat.DATA_MATRIX);
addTest(4, 4, 0.0f);
addTest(1, 1, 90.0f);
addTest(3, 3, 180.0f);
vector.addElement(BarcodeFormat.UPC_E);
vector.addElement(BarcodeFormat.EAN_13);
vector.addElement(BarcodeFormat.EAN_8);
- vector.addElement(BarcodeFormat.RSS14);
+ vector.addElement(BarcodeFormat.RSS14);
if (!productsOnly) {
vector.addElement(BarcodeFormat.CODE_39);
- vector.addElement(BarcodeFormat.CODE_93);
+ vector.addElement(BarcodeFormat.CODE_93);
vector.addElement(BarcodeFormat.CODE_128);
vector.addElement(BarcodeFormat.ITF);
vector.addElement(BarcodeFormat.QR_CODE);
- vector.addElement(BarcodeFormat.DATAMATRIX);
+ vector.addElement(BarcodeFormat.DATA_MATRIX);
vector.addElement(BarcodeFormat.PDF417);
//vector.addElement(BarcodeFormat.CODABAR);
}
System.out.println(uri.toString() + " (format: " + result.getBarcodeFormat() +
", type: " + parsedResult.getType() + "):\nRaw result:\n" + result.getText() +
"\nParsed result:\n" + parsedResult.getDisplayResult());
-
+
System.out.println("Also, there were " + result.getResultPoints().length + " result points.");
for (int i = 0; i < result.getResultPoints().length; i++) {
ResultPoint rp = result.getResultPoints()[i];
possibleFormats.add(BarcodeFormat.EAN_8);
possibleFormats.add(BarcodeFormat.EAN_13);
possibleFormats.add(BarcodeFormat.CODE_39);
- possibleFormats.add(BarcodeFormat.CODE_93);
+ possibleFormats.add(BarcodeFormat.CODE_93);
possibleFormats.add(BarcodeFormat.CODE_128);
//possibleFormats.add(BarcodeFormat.CODABAR);
possibleFormats.add(BarcodeFormat.ITF);
- possibleFormats.add(BarcodeFormat.RSS14);
+ possibleFormats.add(BarcodeFormat.RSS14);
possibleFormats.add(BarcodeFormat.QR_CODE);
- possibleFormats.add(BarcodeFormat.DATAMATRIX);
+ possibleFormats.add(BarcodeFormat.DATA_MATRIX);
possibleFormats.add(BarcodeFormat.PDF417);
HINTS.put(DecodeHintType.POSSIBLE_FORMATS, possibleFormats);
HINTS_PURE = new Hashtable<DecodeHintType, Object>(HINTS);
}
if (image == null) {
response.sendRedirect("badimage.jspx");
- return;
+ return;
}
if (image.getHeight() <= 1 || image.getWidth() <= 1 ||
image.getHeight() * image.getWidth() > MAX_PIXELS) {
- log.fine("Dimensions too large: " + image.getWidth() + 'x' + image.getHeight());
+ log.fine("Dimensions too large: " + image.getWidth() + 'x' + image.getHeight());
response.sendRedirect("badimage.jspx");
return;
}