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

Method drawFinderPattern

src/third-party/qrcodegen/index.ts:315–325  ·  view source on GitHub ↗
(x: int, y: int)

Source from the content-addressed store, hash-verified

313 // Draws a 9*9 finder pattern including the border separator,
314 // with the center module at (x, y). Modules can be out of bounds.
315 private drawFinderPattern(x: int, y: int): void {
316 for (let dy = -4; dy <= 4; dy++) {
317 for (let dx = -4; dx <= 4; dx++) {
318 const dist: int = Math.max(Math.abs(dx), Math.abs(dy)); // Chebyshev/infinity norm
319 const xx: int = x + dx;
320 const yy: int = y + dy;
321 if (0 <= xx && xx < this.size && 0 <= yy && yy < this.size)
322 this.setFunctionModule(xx, yy, dist != 2 && dist != 4);
323 }
324 }
325 }
326
327
328 // Draws a 5*5 alignment pattern, with the center module

Callers 1

drawFunctionPatternsMethod · 0.95

Calls 1

setFunctionModuleMethod · 0.95

Tested by

no test coverage detected