Update DMRE versions to ISO/IEC 21471:2020 (#1369)
|
@ -159,7 +159,7 @@ public final class BitMatrix implements Cloneable {
|
|||
*/
|
||||
public boolean get(int x, int y) {
|
||||
int offset = y * rowSize + (x / 32);
|
||||
return offset < bits.length && ((bits[offset] >>> (x & 0x1f)) & 1) != 0;
|
||||
return ((bits[offset] >>> (x & 0x1f)) & 1) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,16 +170,12 @@ public final class BitMatrix implements Cloneable {
|
|||
*/
|
||||
public void set(int x, int y) {
|
||||
int offset = y * rowSize + (x / 32);
|
||||
if (offset < bits.length) {
|
||||
bits[offset] |= 1 << (x & 0x1f);
|
||||
}
|
||||
bits[offset] |= 1 << (x & 0x1f);
|
||||
}
|
||||
|
||||
public void unset(int x, int y) {
|
||||
int offset = y * rowSize + (x / 32);
|
||||
if (offset < bits.length) {
|
||||
bits[offset] &= ~(1 << (x & 0x1f));
|
||||
}
|
||||
bits[offset] &= ~(1 << (x & 0x1f));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -190,9 +186,7 @@ public final class BitMatrix implements Cloneable {
|
|||
*/
|
||||
public void flip(int x, int y) {
|
||||
int offset = y * rowSize + (x / 32);
|
||||
if (offset < bits.length) {
|
||||
bits[offset] ^= 1 << (x & 0x1f);
|
||||
}
|
||||
bits[offset] ^= 1 << (x & 0x1f);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -136,8 +136,7 @@ final class BitMatrixParser {
|
|||
}
|
||||
} while ((row < numRows) || (column < numColumns));
|
||||
|
||||
if (resultOffset != version.getTotalCodewords() &&
|
||||
resultOffset != version.getTotalCodewords() - 1) {
|
||||
if (resultOffset != version.getTotalCodewords()) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
return result;
|
||||
|
@ -162,6 +161,9 @@ final class BitMatrixParser {
|
|||
column += numColumns;
|
||||
row += 4 - ((numColumns + 4) & 0x07);
|
||||
}
|
||||
if (row >= numRows) {
|
||||
row -= numRows;
|
||||
}
|
||||
readMappingMatrix.set(column, row);
|
||||
return mappingBitMatrix.get(column, row);
|
||||
}
|
||||
|
|
|
@ -233,33 +233,42 @@ public final class Version {
|
|||
new ECBlocks(28, new ECB(1, 49))),
|
||||
|
||||
// extended forms as specified in
|
||||
// AIM-D - Symbology Specification – Data Matrix Rectangular Extension (DMRE)
|
||||
// Revision 1.0 September 22, 2014
|
||||
// ISO 21471:2020 (DMRE) 5.5.1 Table 7
|
||||
new Version(31, 8, 48, 6, 22,
|
||||
new ECBlocks(15, new ECB(1, 18))),
|
||||
new Version(32, 8, 64, 6, 14,
|
||||
new ECBlocks(18, new ECB(1, 24))),
|
||||
new Version(33, 12, 48, 10, 22,
|
||||
new ECBlocks(23, new ECB(1, 32))),
|
||||
new Version(34, 12, 64, 10, 14,
|
||||
new Version(33, 8, 80, 6, 18,
|
||||
new ECBlocks(22, new ECB(1, 32))),
|
||||
new Version(34, 8, 96, 6, 22,
|
||||
new ECBlocks(28, new ECB(1, 38))),
|
||||
new Version(35, 8, 120, 6, 18,
|
||||
new ECBlocks(32, new ECB(1, 49))),
|
||||
new Version(36, 8, 144, 6, 22,
|
||||
new ECBlocks(36, new ECB(1, 63))),
|
||||
new Version(37, 12, 64, 10, 14,
|
||||
new ECBlocks(27, new ECB(1, 43))),
|
||||
new Version(35, 16, 64, 14, 14,
|
||||
new Version(38, 12, 88, 10, 20,
|
||||
new ECBlocks(36, new ECB(1, 64))),
|
||||
new Version(39, 16, 64, 14, 14,
|
||||
new ECBlocks(36, new ECB(1, 62))),
|
||||
new Version(36, 24, 32, 22, 14,
|
||||
new ECBlocks(28, new ECB(1, 49))),
|
||||
new Version(37, 24, 36, 22, 16,
|
||||
new ECBlocks(33, new ECB(1, 55))),
|
||||
new Version(38, 24, 48, 22, 22,
|
||||
new Version(40, 20, 36, 18, 16,
|
||||
new ECBlocks(28, new ECB(1, 44))),
|
||||
new Version(41, 20, 44, 18, 20,
|
||||
new ECBlocks(34, new ECB(1, 56))),
|
||||
new Version(42, 20, 64, 18, 14,
|
||||
new ECBlocks(42, new ECB(1, 84))),
|
||||
new Version(43, 22, 48, 20, 22,
|
||||
new ECBlocks(38, new ECB(1, 72))),
|
||||
new Version(44, 24, 48, 22, 22,
|
||||
new ECBlocks(41, new ECB(1, 80))),
|
||||
new Version(39, 24, 64, 22, 14,
|
||||
new Version(45, 24, 64, 22, 14,
|
||||
new ECBlocks(46, new ECB(1, 108))),
|
||||
new Version(40, 26, 32, 24, 14,
|
||||
new ECBlocks(32, new ECB(1, 52))),
|
||||
new Version(41, 26, 40, 24, 18,
|
||||
new Version(46, 26, 40, 24, 18,
|
||||
new ECBlocks(38, new ECB(1, 70))),
|
||||
new Version(42, 26, 48, 24, 22,
|
||||
new Version(47, 26, 48, 24, 22,
|
||||
new ECBlocks(42, new ECB(1, 90))),
|
||||
new Version(43, 26, 64, 24, 14,
|
||||
new Version(48, 26, 64, 24, 14,
|
||||
new ECBlocks(50, new ECB(1, 118)))
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright 2008 ZXing authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.zxing.datamatrix;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.MultiFormatReader;
|
||||
import com.google.zxing.common.AbstractBlackBoxTestCase;
|
||||
|
||||
/**
|
||||
* @author gitlost
|
||||
*/
|
||||
public final class DataMatrixBlackBox3TestCase extends AbstractBlackBoxTestCase {
|
||||
|
||||
public DataMatrixBlackBox3TestCase() {
|
||||
super("src/test/resources/blackbox/datamatrix-3", new MultiFormatReader(), BarcodeFormat.DATA_MATRIX);
|
||||
addTest(18, 18, 0.0f);
|
||||
addTest(17, 17, 90.0f);
|
||||
addTest(18, 18, 180.0f);
|
||||
addTest(18, 18, 270.0f);
|
||||
}
|
||||
|
||||
}
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-120x8.png
Normal file
After Width: | Height: | Size: 224 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-144x8.png
Normal file
After Width: | Height: | Size: 245 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmno
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-36x20.png
Normal file
After Width: | Height: | Size: 232 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-40x26.png
Normal file
After Width: | Height: | Size: 278 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-44x20.png
Normal file
After Width: | Height: | Size: 249 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-48x22.png
Normal file
After Width: | Height: | Size: 274 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-48x24.png
Normal file
After Width: | Height: | Size: 289 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-48x26.png
Normal file
After Width: | Height: | Size: 305 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabc
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-48x8.png
Normal file
After Width: | Height: | Size: 167 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxy
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-64x12.png
Normal file
After Width: | Height: | Size: 220 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-64x16.png
Normal file
After Width: | Height: | Size: 261 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-64x20.png
Normal file
After Width: | Height: | Size: 298 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-64x24.png
Normal file
After Width: | Height: | Size: 338 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-64x26.png
Normal file
After Width: | Height: | Size: 364 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-64x8.png
Normal file
After Width: | Height: | Size: 181 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefgh
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-80x8.png
Normal file
After Width: | Height: | Size: 195 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-88x12.png
Normal file
After Width: | Height: | Size: 252 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnop
|
BIN
core/src/test/resources/blackbox/datamatrix-3/abcd-96x8.png
Normal file
After Width: | Height: | Size: 207 B |
|
@ -0,0 +1 @@
|
|||
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabc
|