import BitMatrix from '../../common/BitMatrix'; import Version from './Version'; /** * @author bbrown@google.com (Brian Brown) */ export default class BitMatrixParser { private mappingBitMatrix; private readMappingMatrix; private version; /** * @param bitMatrix {@link BitMatrix} to parse * @throws FormatException if dimension is < 8 or > 144 or not 0 mod 2 */ constructor(bitMatrix: BitMatrix); getVersion(): Version; /** *
Creates the version object based on the dimension of the original bit matrix from * the datamatrix code.
* *See ISO 16022:2006 Table 7 - ECC 200 symbol attributes
* * @param bitMatrix Original {@link BitMatrix} including alignment patterns * @return {@link Version} encapsulating the Data Matrix Code's "version" * @throws FormatException if the dimensions of the mapping matrix are not valid * Data Matrix dimensions. */ static readVersion(bitMatrix: BitMatrix): Version; /** *Reads the bits in the {@link BitMatrix} representing the mapping matrix (No alignment patterns) * in the correct order in order to reconstitute the codewords bytes contained within the * Data Matrix Code.
* * @return bytes encoded within the Data Matrix Code * @throws FormatException if the exact number of bytes expected is not read */ readCodewords(): Int8Array; /** *Reads a bit of the mapping matrix accounting for boundary wrapping.
* * @param row Row to read in the mapping matrix * @param column Column to read in the mapping matrix * @param numRows Number of rows in the mapping matrix * @param numColumns Number of columns in the mapping matrix * @return value of the given bit in the mapping matrix */ private readModule; /** *Reads the 8 bits of the standard Utah-shaped pattern.
* *See ISO 16022:2006, 5.8.1 Figure 6
* * @param row Current row in the mapping matrix, anchored at the 8th bit (LSB) of the pattern * @param column Current column in the mapping matrix, anchored at the 8th bit (LSB) of the pattern * @param numRows Number of rows in the mapping matrix * @param numColumns Number of columns in the mapping matrix * @return byte from the utah shape */ private readUtah; /** *Reads the 8 bits of the special corner condition 1.
* *See ISO 16022:2006, Figure F.3
* * @param numRows Number of rows in the mapping matrix * @param numColumns Number of columns in the mapping matrix * @return byte from the Corner condition 1 */ private readCorner1; /** *Reads the 8 bits of the special corner condition 2.
* *See ISO 16022:2006, Figure F.4
* * @param numRows Number of rows in the mapping matrix * @param numColumns Number of columns in the mapping matrix * @return byte from the Corner condition 2 */ private readCorner2; /** *Reads the 8 bits of the special corner condition 3.
* *See ISO 16022:2006, Figure F.5
* * @param numRows Number of rows in the mapping matrix * @param numColumns Number of columns in the mapping matrix * @return byte from the Corner condition 3 */ private readCorner3; /** *Reads the 8 bits of the special corner condition 4.
* *See ISO 16022:2006, Figure F.6
* * @param numRows Number of rows in the mapping matrix * @param numColumns Number of columns in the mapping matrix * @return byte from the Corner condition 4 */ private readCorner4; /** *Extracts the data region from a {@link BitMatrix} that contains * alignment patterns.
* * @param bitMatrix Original {@link BitMatrix} with alignment patterns * @return BitMatrix that has the alignment patterns removed */ private extractDataRegion; }