🚿 mask pattern cleanup

This commit is contained in:
codemasher
2021-11-26 20:36:27 +01:00
parent 9037a69626
commit 738294e344
4 changed files with 30 additions and 26 deletions
+3 -11
View File
@@ -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);
}
}