\BaconQrCode\CommonBitMatrix

Bit matrix.

Represents a 2D matrix of bits. In function arguments below, and throughout the common module, x is the column position, and y is the row position. The ordering is always x, y. The origin is at the top-left.

Summary

Methods
Properties
Constants
__construct()
get()
set()
flip()
clear()
setRegion()
getRow()
setRow()
getEnclosingRectangle()
getTopLeftOnBit()
getBottomRightOnBit()
getWidth()
getHeight()
No public properties found
No constants found
No protected methods found
$width
$height
$rowSize
$bits
N/A
No private methods found
No private properties found
N/A

Properties

$width

$width : integer

Width of the bit matrix.

Type

integer

$height

$height : integer

Height of the bit matrix.

Type

integer

$rowSize

$rowSize : integer

Size in bits of each individual row.

Type

integer

$bits

$bits : \SplFixedArray

Bits representation.

Type

\SplFixedArray

Methods

__construct()

__construct(integer  $width, integer|null  $height = null) 

Creates a new bit matrix with given dimensions.

Parameters

integer $width
integer|null $height

Throws

\BaconQrCode\Common\Exception\InvalidArgumentException

get()

get(integer  $x, integer  $y) : boolean

Gets the requested bit, where true means black.

Parameters

integer $x
integer $y

Returns

boolean

set()

set(integer  $x, integer  $y) : void

Sets the given bit to true.

Parameters

integer $x
integer $y

flip()

flip(integer  $x, integer  $y) : void

Flips the given bit.

Parameters

integer $x
integer $y

clear()

clear() : void

Clears all bits (set to false).

setRegion()

setRegion(integer  $left, integer  $top, integer  $width, integer  $height) : void

Sets a square region of the bit matrix to true.

Parameters

integer $left
integer $top
integer $width
integer $height

setRow()

setRow(integer  $y, \BaconQrCode\Common\BitArray  $row) : void

Sets a row of data from a BitArray.

Parameters

integer $y
\BaconQrCode\Common\BitArray $row

getEnclosingRectangle()

getEnclosingRectangle() : \SplFixedArray

This is useful in detecting the enclosing rectangle of a 'pure' barcode.

Returns

\SplFixedArray

getTopLeftOnBit()

getTopLeftOnBit() : \SplFixedArray

Gets the most top left set bit.

This is useful in detecting a corner of a 'pure' barcode.

Returns

\SplFixedArray

getBottomRightOnBit()

getBottomRightOnBit() : \SplFixedArray

Gets the most bottom right set bit.

This is useful in detecting a corner of a 'pure' barcode.

Returns

\SplFixedArray

getWidth()

getWidth() : integer

Gets the width of the matrix,

Returns

integer

getHeight()

getHeight() : integer

Gets the height of the matrix.

Returns

integer