:octocat: move mask pattern parameter

This commit is contained in:
smiley
2023-04-04 20:21:04 +02:00
parent 9bc23a2161
commit 50179a97ef
6 changed files with 38 additions and 28 deletions
+7 -3
View File
@@ -117,11 +117,15 @@ final class BitMatrix extends QRMatrix{
$this
->readFormatInformation()
->readVersion()
->mask() // reverse the mask pattern
->mask($this->maskPattern) // reverse the mask pattern
;
// invoke a fresh matrix with only the function & format patterns to compare against
$fp = (new QRMatrix($this->version, $this->eccLevel, $this->maskPattern))->initFunctionalPatterns();
$matrix = (new QRMatrix($this->version, $this->eccLevel))
->initFunctionalPatterns()
->setFormatInfo($this->maskPattern)
;
$result = [];
$byte = 0;
$bitsRead = 0;
@@ -143,7 +147,7 @@ final class BitMatrix extends QRMatrix{
$x = ($i - $col);
// Ignore bits covered by the function pattern
if($fp->get($x, $y) !== $this::M_NULL){
if($matrix->get($x, $y) !== $this::M_NULL){
continue;
}
+3 -2
View File
@@ -88,10 +88,11 @@ final class DecoderResult{
* Returns a QRMatrix instance with thesettings and data of the reader result
*/
public function getQRMatrix():QRMatrix{
return (new QRMatrix($this->version, $this->eccLevel, $this->maskPattern))
return (new QRMatrix($this->version, $this->eccLevel))
->initFunctionalPatterns()
->writeCodewords($this->rawBytes)
->mask()
->setFormatInfo($this->maskPattern)
->mask($this->maskPattern)
;
}