Table of Contents

Class BinaryBitmap

Namespace
ZXing
Assembly
zxing.dll

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.

public sealed class BinaryBitmap
Inheritance
BinaryBitmap
Inherited Members

Constructors

BinaryBitmap(Binarizer)

public BinaryBitmap(Binarizer binarizer)

Parameters

binarizer Binarizer

Properties

BlackMatrix

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.

public BitMatrix BlackMatrix { get; }

Property Value

BitMatrix

The 2D array of bits for the image (true means black).

CropSupported

public bool CropSupported { get; }

Property Value

bool

Whether this bitmap can be cropped.

Height

public int Height { get; }

Property Value

int

The height of the bitmap.

RotateSupported

public bool RotateSupported { get; }

Property Value

bool

Whether this bitmap supports counter-clockwise rotation.

Width

public int Width { get; }

Property Value

int

The width of the bitmap.

Methods

ToString()

Returns a string that represents this instance.

public override string ToString()

Returns

string

A string that represents this instance.

crop(int, int, int, int)

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.

public BinaryBitmap crop(int left, int top, int width, int height)

Parameters

left int

The left coordinate, which must be in [0, Width)

top int

The top coordinate, which must be in [0, Height)

width int

The width of the rectangle to crop.

height int

The height of the rectangle to crop.

Returns

BinaryBitmap

A cropped version of this object.

getBlackRow(int, BitArray)

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.

public BitArray getBlackRow(int y, BitArray row)

Parameters

y int

The row to fetch, which must be in [0, bitmap height).

row BitArray

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

BitArray

The array of bits for this row (true means black).

rotateCounterClockwise()

Returns a new object with rotated image data by 90 degrees counterclockwise. Only callable if RotateSupported is true.

public BinaryBitmap rotateCounterClockwise()

Returns

BinaryBitmap

A rotated version of this object.

rotateCounterClockwise45()

Returns a new object with rotated image data by 45 degrees counterclockwise. Only callable if RotateSupported is true.

public BinaryBitmap rotateCounterClockwise45()

Returns

BinaryBitmap

A rotated version of this object.