com.google.zxing
Class BinaryBitmap

java.lang.Object
  extended by com.google.zxing.BinaryBitmap

public final class BinaryBitmap
extends Object

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.

Since:
BlackBerry API 6.0.0

Constructor Summary
BinaryBitmap(Binarizer binarizer)
           
 
Method Summary
 BinaryBitmap crop(int left, int top, int width, int height)
          Returns a new object with cropped image data.
 BitMatrix getBlackMatrix()
          Converts a 2D array of luminance data to 1 bit.
 BitArray getBlackRow(int y, BitArray row)
          Converts one row of luminance data to 1 bit data.
 int getHeight()
           
 int getWidth()
           
 boolean isCropSupported()
           
 boolean isRotateSupported()
           
 BinaryBitmap rotateCounterClockwise()
          Returns a new object with rotated image data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

BinaryBitmap

public BinaryBitmap(Binarizer binarizer)
Since:
BlackBerry API 6.0.0


Method Detail

getWidth

public int getWidth()
Returns:
The width of the bitmap.
Since:
BlackBerry API 6.0.0

getHeight

public int getHeight()
Returns:
The height of the bitmap.
Since:
BlackBerry API 6.0.0

getBlackRow

public BitArray getBlackRow(int y,
                            BitArray row)
                     throws ReaderException
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.

Parameters:
y - The row to fetch, 0 <= y < bitmap height.
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.
Returns:
The array of bits for this row (true means black).
Throws:
ReaderException
Since:
BlackBerry API 6.0.0

getBlackMatrix

public BitMatrix getBlackMatrix()
                         throws ReaderException
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.

Returns:
The 2D array of bits for the image (true means black).
Throws:
ReaderException
Since:
BlackBerry API 6.0.0

isCropSupported

public boolean isCropSupported()
Returns:
Whether this bitmap can be cropped.
Since:
BlackBerry API 6.0.0

crop

public BinaryBitmap crop(int left,
                         int top,
                         int width,
                         int height)
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.

Parameters:
left - The left coordinate, 0 <= left < getWidth().
top - The top coordinate, 0 <= top <= getHeight().
width - The width of the rectangle to crop.
height - The height of the rectangle to crop.
Returns:
A cropped version of this object.
Since:
BlackBerry API 6.0.0

isRotateSupported

public boolean isRotateSupported()
Returns:
Whether this bitmap supports counter-clockwise rotation.
Since:
BlackBerry API 6.0.0

rotateCounterClockwise

public BinaryBitmap rotateCounterClockwise()
Returns a new object with rotated image data. Only callable if isRotateSupported() is true.

Returns:
A rotated version of this object.
Since:
BlackBerry API 6.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.