decodeRow method
Attempts to decode a one-dimensional barcode format given a single row of an image.
@param rowNumber row number from top of the row @param row the black/white pixel data of the row @param hints decode hints @return Result containing encoded string and start/end of barcode @throws NotFoundException if no potential barcode is found @throws ChecksumException if a potential barcode is found but does not pass its checksum @throws FormatException if a potential barcode is found but format is invalid
Implementation
@override
Result decodeRow(
int rowNumber,
BitArray row,
DecodeHint? hints,
) {
final leftPair = _decodePair(row, false, rowNumber, hints);
_addOrTally(_possibleLeftPairs, leftPair);
row.reverse();
final rightPair = _decodePair(row, true, rowNumber, hints);
_addOrTally(_possibleRightPairs, rightPair);
row.reverse();
for (Pair left in _possibleLeftPairs) {
if (left.count > 1) {
for (Pair right in _possibleRightPairs) {
if (right.count > 1 && _checkChecksum(left, right)) {
return _constructResult(left, right);
}
}
}
}
throw NotFoundException.instance;
}