MCPcopy Create free account
hub / github.com/pingdotgg/t3code / drawFunctionPatterns

Method drawFunctionPatterns

packages/shared/src/qrCode.ts:248–274  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

246
247 // Reads this object's version field, and draws and marks all function modules.
248 private drawFunctionPatterns(): void {
249 // Draw horizontal and vertical timing patterns
250 for (let i = 0; i < this.size; i++) {
251 this.setFunctionModule(6, i, i % 2 == 0);
252 this.setFunctionModule(i, 6, i % 2 == 0);
253 }
254
255 // Draw 3 finder patterns (all corners except bottom right; overwrites some timing modules)
256 this.drawFinderPattern(3, 3);
257 this.drawFinderPattern(this.size - 4, 3);
258 this.drawFinderPattern(3, this.size - 4);
259
260 // Draw numerous alignment patterns
261 const alignPatPos: Array<int> = this.getAlignmentPatternPositions();
262 const numAlign: int = alignPatPos.length;
263 for (let i = 0; i < numAlign; i++) {
264 for (let j = 0; j < numAlign; j++) {
265 // Don't draw on the three finder corners
266 if (!((i == 0 && j == 0) || (i == 0 && j == numAlign - 1) || (i == numAlign - 1 && j == 0)))
267 this.drawAlignmentPattern(alignPatPos[i]!, alignPatPos[j]!);
268 }
269 }
270
271 // Draw configuration data
272 this.drawFormatBits(0); // Dummy mask value; overwritten later in the constructor
273 this.drawVersion();
274 }
275
276 // Draws two copies of the format bits (with its own error correction code)
277 // based on the given mask and this object's error correction level field.

Callers 1

constructorMethod · 0.95

Calls 6

setFunctionModuleMethod · 0.95
drawFinderPatternMethod · 0.95
drawAlignmentPatternMethod · 0.95
drawFormatBitsMethod · 0.95
drawVersionMethod · 0.95

Tested by

no test coverage detected