pub trait OneDReader: Reader {
const QUIET_ZONE: usize = 15;
// Required method
fn decode_row(
&mut self,
rowNumber: u32,
row: &BitArray,
hints: &DecodeHints,
) -> Result<RXingResult>;
// Provided methods
fn _do_decode<B: Binarizer>(
&mut self,
image: &mut BinaryBitmap<B>,
hints: &DecodeHints,
) -> Result<RXingResult> { ... }
fn decode_pure(
&mut self,
rowNumber: u32,
row: &[u8],
hints: &DecodeHints,
) -> Result<RXingResult> { ... }
}Expand description
Encapsulates functionality and implementation that is common to all families of one-dimensional barcodes.
@author dswitkin@google.com (Daniel Switkin) @author Sean Owen
Provided Associated Constants§
const QUIET_ZONE: usize = 15
Required Methods§
Sourcefn decode_row(
&mut self,
rowNumber: u32,
row: &BitArray,
hints: &DecodeHints,
) -> Result<RXingResult>
fn decode_row( &mut self, rowNumber: u32, row: &BitArray, hints: &DecodeHints, ) -> Result<RXingResult>
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 {@link RXingResult} 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
Provided Methods§
Sourcefn _do_decode<B: Binarizer>(
&mut self,
image: &mut BinaryBitmap<B>,
hints: &DecodeHints,
) -> Result<RXingResult>
fn _do_decode<B: Binarizer>( &mut self, image: &mut BinaryBitmap<B>, hints: &DecodeHints, ) -> Result<RXingResult>
We’re going to examine rows from the middle outward, searching alternately above and below the middle, and farther out each time. rowStep is the number of rows between each successive attempt above and below the middle. So we’d scan row middle, then middle - rowStep, then middle + rowStep, then middle - (2 * rowStep), etc. rowStep is bigger as the image is taller, but is always at least 1. We’ve somewhat arbitrarily decided that moving up and down by about 1/16 of the image is pretty good; we try more of the image if “trying harder”.
@param image The image to decode @param hints Any hints that were requested @return The contents of the decoded barcode @throws NotFoundException Any spontaneous errors which occur
fn decode_pure( &mut self, rowNumber: u32, row: &[u8], hints: &DecodeHints, ) -> Result<RXingResult>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.