/** * Revert the mask removal done while reading the code words. The bit matrix should revert to its original state. */ function remask() { if ($this->parsedFormatInfo == null) { return; // We have no format information, and have no data mask } $dataMask = DataMask::forReference($this->parsedFormatInfo->getDataMask()); $dimension = $this->bitMatrix->getHeight(); $dataMask->unmaskBitMatrix($this->bitMatrix, $dimension); }
} abstract function isMasked($i, $j); /** * @param reference a value between 0 and 7 indicating one of the eight possible * data mask patterns a QR Code may use * @return DataMask encapsulating the data mask pattern */ static function forReference($reference) { if ($reference < 0 || $reference > 7) { throw new InvalidArgumentException(); } return self::$DATA_MASKS[$reference]; } } DataMask::Init(); /** * 000: mask bits for which (x + y) mod 2 == 0 */ final class DataMask000 extends DataMask { // @Override function isMasked($i, $j) { return ($i + $j & 0x1) == 0; } } /** * 001: mask bits for which x mod 2 == 0 */ final class DataMask001 extends DataMask