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

Method getAlignmentPatternPositions

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

Source from the content-addressed store, hash-verified

524 // Each position is in the range [0,177), and are used on both the x and y axes.
525 // This could be implemented as lookup table of 40 variable-length lists of integers.
526 private getAlignmentPatternPositions(): Array<int> {
527 if (this.version == 1)
528 return [];
529 else {
530 const numAlign: int = Math.floor(this.version / 7) + 2;
531 const step: int = (this.version == 32) ? 26 :
532 Math.ceil((this.version * 4 + 4) / (numAlign * 2 - 2)) * 2;
533 let result: Array<int> = [6];
534 for (let pos = this.size - 7; result.length < numAlign; pos -= step)
535 result.splice(1, 0, pos);
536 return result;
537 }
538 }
539
540
541 // Returns the number of data bits that can be stored in a QR Code of the given version number, after

Callers 1

drawFunctionPatternsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected