MCPcopy
hub / github.com/zpao/qrcode.react / drawFunctionPatterns

Method drawFunctionPatterns

src/third-party/qrcodegen/index.ts:231–257  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

229
230 // Reads this object's version field, and draws and marks all function modules.
231 private drawFunctionPatterns(): void {
232 // Draw horizontal and vertical timing patterns
233 for (let i = 0; i < this.size; i++) {
234 this.setFunctionModule(6, i, i % 2 == 0);
235 this.setFunctionModule(i, 6, i % 2 == 0);
236 }
237
238 // Draw 3 finder patterns (all corners except bottom right; overwrites some timing modules)
239 this.drawFinderPattern(3, 3);
240 this.drawFinderPattern(this.size - 4, 3);
241 this.drawFinderPattern(3, this.size - 4);
242
243 // Draw numerous alignment patterns
244 const alignPatPos: Array<int> = this.getAlignmentPatternPositions();
245 const numAlign: int = alignPatPos.length;
246 for (let i = 0; i < numAlign; i++) {
247 for (let j = 0; j < numAlign; j++) {
248 // Don't draw on the three finder corners
249 if (!(i == 0 && j == 0 || i == 0 && j == numAlign - 1 || i == numAlign - 1 && j == 0))
250 this.drawAlignmentPattern(alignPatPos[i], alignPatPos[j]);
251 }
252 }
253
254 // Draw configuration data
255 this.drawFormatBits(0); // Dummy mask value; overwritten later in the constructor
256 this.drawVersion();
257 }
258
259
260 // Draws two copies of the format bits (with its own error correction code)

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