UNPKG

@zxing/library

Version:

TypeScript port of ZXing multi-format 1D/2D barcode image processing library.

32 lines (31 loc) 1.28 kB
import BitMatrix from '../../common/BitMatrix'; import DecoderResult from '../../common/DecoderResult'; /** * <p>The main class which implements Data Matrix Code decoding -- as opposed to locating and extracting * the Data Matrix Code from an image.</p> * * @author bbrown@google.com (Brian Brown) */ export default class Decoder { private rsDecoder; constructor(); /** * <p>Decodes a Data Matrix Code represented as a {@link BitMatrix}. A 1 or "true" is taken * to mean a black module.</p> * * @param bits booleans representing white/black Data Matrix Code modules * @return text and bytes encoded within the Data Matrix Code * @throws FormatException if the Data Matrix Code cannot be decoded * @throws ChecksumException if error correction fails */ decode(bits: BitMatrix): DecoderResult; /** * <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to * correct the errors in-place using Reed-Solomon error correction.</p> * * @param codewordBytes data and error correction codewords * @param numDataCodewords number of codewords that are data bytes * @throws ChecksumException if error correction fails */ private correctErrors; }