Struct rxing::BinaryBitmap
source · pub struct BinaryBitmap { /* private fields */ }Expand description
This class is the core bitmap class used by ZXing to represent 1 bit data. Reader objects accept a BinaryBitmap and attempt to decode it.
@author dswitkin@google.com (Daniel Switkin)
Implementations§
source§impl BinaryBitmap
impl BinaryBitmap
pub fn new(binarizer: Rc<dyn Binarizer>) -> Self
sourcepub fn getBlackRow(
&self,
y: usize,
row: &mut BitArray
) -> Result<BitArray, Exceptions>
pub fn getBlackRow(
&self,
y: usize,
row: &mut BitArray
) -> Result<BitArray, Exceptions>
Converts one row of luminance data to 1 bit data. May actually do the conversion, or return cached data. Callers should assume this method is expensive and call it as seldom as possible. This method is intended for decoding 1D barcodes and may choose to apply sharpening.
@param y The row to fetch, which must be in [0, bitmap height) @param row An optional preallocated array. If null or too small, it will be ignored. If used, the Binarizer will call BitArray.clear(). Always use the returned object. @return The array of bits for this row (true means black). @throws NotFoundException if row can’t be binarized
sourcepub fn getBlackMatrixMut(&mut self) -> &mut BitMatrix
pub fn getBlackMatrixMut(&mut self) -> &mut BitMatrix
Converts a 2D array of luminance data to 1 bit. As above, assume this method is expensive and do not call it repeatedly. This method is intended for decoding 2D barcodes and may or may not apply sharpening. Therefore, a row from this matrix may not be identical to one fetched using getBlackRow(), so don’t mix and match between them.
@return The 2D array of bits for the image (true means black). @throws NotFoundException if image can’t be binarized to make a matrix
sourcepub fn getBlackMatrix(&self) -> &BitMatrix
pub fn getBlackMatrix(&self) -> &BitMatrix
Converts a 2D array of luminance data to 1 bit. As above, assume this method is expensive and do not call it repeatedly. This method is intended for decoding 2D barcodes and may or may not apply sharpening. Therefore, a row from this matrix may not be identical to one fetched using getBlackRow(), so don’t mix and match between them.
@return The 2D array of bits for the image (true means black). @throws NotFoundException if image can’t be binarized to make a matrix
sourcepub fn isCropSupported(&self) -> bool
pub fn isCropSupported(&self) -> bool
@return Whether this bitmap can be cropped.
sourcepub fn crop(
&self,
left: usize,
top: usize,
width: usize,
height: usize
) -> BinaryBitmap
pub fn crop(
&self,
left: usize,
top: usize,
width: usize,
height: usize
) -> BinaryBitmap
Returns a new object with cropped image data. Implementations may keep a reference to the original data rather than a copy. Only callable if isCropSupported() is true.
@param left The left coordinate, which must be in [0,getWidth()) @param top The top coordinate, which must be in [0,getHeight()) @param width The width of the rectangle to crop. @param height The height of the rectangle to crop. @return A cropped version of this object.
sourcepub fn isRotateSupported(&self) -> bool
pub fn isRotateSupported(&self) -> bool
@return Whether this bitmap supports counter-clockwise rotation.
sourcepub fn rotateCounterClockwise(&self) -> BinaryBitmap
pub fn rotateCounterClockwise(&self) -> BinaryBitmap
Returns a new object with rotated image data by 90 degrees counterclockwise. Only callable if {@link #isRotateSupported()} is true.
@return A rotated version of this object.
sourcepub fn rotateCounterClockwise45(&self) -> BinaryBitmap
pub fn rotateCounterClockwise45(&self) -> BinaryBitmap
Returns a new object with rotated image data by 45 degrees counterclockwise. Only callable if {@link #isRotateSupported()} is true.
@return A rotated version of this object.
Trait Implementations§
source§impl Clone for BinaryBitmap
impl Clone for BinaryBitmap
source§fn clone(&self) -> BinaryBitmap
fn clone(&self) -> BinaryBitmap
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for BinaryBitmap
impl !Send for BinaryBitmap
impl !Sync for BinaryBitmap
impl Unpin for BinaryBitmap
impl !UnwindSafe for BinaryBitmap
Blanket Implementations§
§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
§impl<T> ConvUtil for T
impl<T> ConvUtil for T
§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, DefaultApprox>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, DefaultApprox>,
§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.