mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-25 01:47:56 +00:00
🚿 mask pattern cleanup
This commit is contained in:
@@ -182,23 +182,15 @@ final class BitMatrix{
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Encapsulates data masks for the data bits in a QR code, per ISO 18004:2006 6.8. Implementations
|
||||
* of this class can un-mask a raw BitMatrix. For simplicity, they will unmask the entire BitMatrix,
|
||||
* including areas used for finder patterns, timing patterns, etc. These areas should be unused
|
||||
* after the point they are unmasked anyway.</p>
|
||||
*
|
||||
* <p>Note that the diagram in section 6.8.1 is misleading since it indicates that i is column position
|
||||
* and j is row position. In fact, as the text says, i is row position and j is column position.</p>
|
||||
*
|
||||
* <p>Implementations of this method reverse the data masking process applied to a QR Code and
|
||||
* make its bits ready to read.</p>
|
||||
* Implementations of this method reverse the data masking process applied to a QR Code and
|
||||
* make its bits ready to read.
|
||||
*/
|
||||
public function unmask(int $dimension, MaskPattern $maskPattern):void{
|
||||
$mask = $maskPattern->getMask();
|
||||
|
||||
for($y = 0; $y < $dimension; $y++){
|
||||
for($x = 0; $x < $dimension; $x++){
|
||||
if($mask($x, $y) === 0){
|
||||
if($mask($x, $y)){
|
||||
$this->flip($x, $y);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user