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

Method getAlignmentPatternPositions

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

Source from the content-addressed store, hash-verified

536 // Each position is in the range [0,177), and are used on both the x and y axes.
537 // This could be implemented as lookup table of 40 variable-length lists of integers.
538 private getAlignmentPatternPositions(): Array<int> {
539 if (this.version == 1) return [];
540 else {
541 const numAlign: int = Math.floor(this.version / 7) + 2;
542 const step: int =
543 this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (numAlign * 2 - 2)) * 2;
544 let result: Array<int> = [6];
545 for (let pos = this.size - 7; result.length < numAlign; pos -= step) result.splice(1, 0, pos);
546 return result;
547 }
548 }
549
550 // Returns the number of data bits that can be stored in a QR Code of the given version number, after
551 // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.

Callers 1

drawFunctionPatternsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected