BitMatrix
in package
Table of Contents
- $bits : array<string|int, mixed>
- $dimension : int
- $formatInfo : FormatInformation|null
- $mirror : bool
- $rowSize : int
- $version : Version|null
- __construct() : mixed
- flip() : self
- Flips the given bit. 1 << (0xf9 & 0x1f)
- get() : bool
- Gets the requested bit, where true means black.
- getDimension() : int
- getFormatInfo() : FormatInformation|null
- getVersion() : Version|null
- mirror() : self
- Mirror the bit matrix in order to attempt a second reading.
- readCodewords() : array<string|int, mixed>
- Reads the bits in the BitMatrix representing the finder pattern in the correct order in order to reconstruct the codewords bytes contained within the QR Code.
- set() : self
- Sets the given bit to true.
- setMirror() : self
- Prepare the parser for a mirrored operation.
- setRegion() : self
- Sets a square region of the bit matrix to true.
- buildFunctionPattern() : self
- See ISO 18004:2006 Annex E
- copyBit() : int
- decodeVersionInformation() : Version|null
- doDecodeFormatInformation() : FormatInformation|null
- numBitsDiffering() : int
- readFormatInformation() : FormatInformation
- Reads format information from one of its two locations within the QR Code.
- readVersion() : Version
- Reads version information from one of its two locations within the QR Code.
- unmask() : void
- Implementations of this method reverse the data masking process applied to a QR Code and make its bits ready to read.
- uRShift() : int
Properties
$bits
private
array<string|int, mixed>
$bits
$dimension
private
int
$dimension
$formatInfo
private
FormatInformation|null
$formatInfo
= null
$mirror
private
bool
$mirror
= false
$rowSize
private
int
$rowSize
$version
private
Version|null
$version
= null
Methods
__construct()
public
__construct(int $dimension) : mixed
Parameters
- $dimension : int
Return values
mixed —flip()
Flips the given bit. 1 << (0xf9 & 0x1f)
public
flip(int $x, int $y) : self
Parameters
- $x : int
-
; The horizontal component (i.e. which column)
- $y : int
-
; The vertical component (i.e. which row)
Return values
self —get()
Gets the requested bit, where true means black.
public
get(int $x, int $y) : bool
Parameters
- $x : int
-
The horizontal component (i.e. which column)
- $y : int
-
The vertical component (i.e. which row)
Return values
bool —value of given bit in matrix
getDimension()
public
getDimension() : int
Return values
int —The dimension (width/height) of the matrix
getFormatInfo()
public
getFormatInfo() : FormatInformation|null
Return values
FormatInformation|null —getVersion()
public
getVersion() : Version|null
Return values
Version|null —mirror()
Mirror the bit matrix in order to attempt a second reading.
public
mirror() : self
Return values
self —readCodewords()
Reads the bits in the BitMatrix representing the finder pattern in the correct order in order to reconstruct the codewords bytes contained within the QR Code.
public
readCodewords() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —bytes encoded within the QR Code
set()
Sets the given bit to true.
public
set(int $x, int $y) : self
Parameters
- $x : int
-
; The horizontal component (i.e. which column)
- $y : int
-
; The vertical component (i.e. which row)
Return values
self —setMirror()
Prepare the parser for a mirrored operation.
public
setMirror(bool $mirror) : self
This flag has effect only on the readFormatInformation() and the readVersion() methods. Before proceeding with readCodewords() the mirror() method should be called.
Parameters
- $mirror : bool
-
Whether to read version and format information mirrored.
Return values
self —setRegion()
Sets a square region of the bit matrix to true.
public
setRegion(int $left, int $top, int $width, int $height) : self
Parameters
- $left : int
-
; The horizontal position to begin at (inclusive)
- $top : int
-
; The vertical position to begin at (inclusive)
- $width : int
-
; The width of the region
- $height : int
-
; The height of the region
Tags
Return values
self —buildFunctionPattern()
See ISO 18004:2006 Annex E
private
buildFunctionPattern() : self
Return values
self —copyBit()
private
copyBit(int $i, int $j, int $versionBits) : int
Parameters
- $i : int
- $j : int
- $versionBits : int
Return values
int —decodeVersionInformation()
private
decodeVersionInformation(int $versionBits) : Version|null
Parameters
- $versionBits : int
Return values
Version|null —doDecodeFormatInformation()
private
doDecodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2) : FormatInformation|null
Parameters
- $maskedFormatInfo1 : int
-
format info indicator, with mask still applied
- $maskedFormatInfo2 : int
-
second copy of same info; both are checked at the same time to establish best match
Return values
FormatInformation|null —information about the format it specifies, or null if doesn't seem to match any known pattern
numBitsDiffering()
private
numBitsDiffering(int $a, int $b) : int
Parameters
- $a : int
- $b : int
Return values
int —readFormatInformation()
Reads format information from one of its two locations within the QR Code.
private
readFormatInformation() : FormatInformation
Tags
Return values
FormatInformation —encapsulating the QR Code's format info
readVersion()
Reads version information from one of its two locations within the QR Code.
private
readVersion() : Version
Tags
Return values
Version —encapsulating the QR Code's version
unmask()
Implementations of this method reverse the data masking process applied to a QR Code and make its bits ready to read.
private
unmask() : void
Return values
void —uRShift()
private
uRShift(int $a, int $b) : int
Parameters
- $a : int
- $b : int