(version: Version)
| 72 | } |
| 73 | |
| 74 | function buildFunctionPatternMask(version: Version): BitMatrix { |
| 75 | const dimension = 17 + 4 * version.versionNumber; |
| 76 | const matrix = BitMatrix.createEmpty(dimension, dimension); |
| 77 | |
| 78 | matrix.setRegion(0, 0, 9, 9, true); // Top left finder pattern + separator + format |
| 79 | matrix.setRegion(dimension - 8, 0, 8, 9, true); // Top right finder pattern + separator + format |
| 80 | matrix.setRegion(0, dimension - 8, 9, 8, true); // Bottom left finder pattern + separator + format |
| 81 | |
| 82 | // Alignment patterns |
| 83 | for (const x of version.alignmentPatternCenters) { |
| 84 | for (const y of version.alignmentPatternCenters) { |
| 85 | if (!(x === 6 && y === 6 || x === 6 && y === dimension - 7 || x === dimension - 7 && y === 6)) { |
| 86 | matrix.setRegion(x - 2, y - 2, 5, 5, true); |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | matrix.setRegion(6, 9, 1, dimension - 17, true); // Vertical timing pattern |
| 92 | matrix.setRegion(9, 6, dimension - 17, 1, true); // Horizontal timing pattern |
| 93 | |
| 94 | if (version.versionNumber > 6) { |
| 95 | matrix.setRegion(dimension - 11, 0, 3, 6, true); // Version info, top right |
| 96 | matrix.setRegion(0, dimension - 11, 6, 3, true); // Version info, bottom left |
| 97 | } |
| 98 | |
| 99 | return matrix; |
| 100 | } |
| 101 | |
| 102 | function readCodewords(matrix: BitMatrix, version: Version, formatInfo: FormatInformation) { |
| 103 | const dataMask = DATA_MASKS[formatInfo.dataMask]; |
no test coverage detected
searching dependent graphs…