qrcodegen.d.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /**
  2. * Use of this source code is governed by an MIT-style license that can be
  3. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  4. */
  5. declare namespace qrcodegen {
  6. type bit = number;
  7. type byte = number;
  8. type int = number;
  9. export class QrCode {
  10. readonly version: int;
  11. readonly errorCorrectionLevel: QrCode.Ecc;
  12. static encodeText(text: string, ecl: QrCode.Ecc): QrCode;
  13. static encodeBinary(data: readonly byte[], ecl: QrCode.Ecc): QrCode;
  14. static encodeSegments(segs: readonly QrSegment[], ecl: QrCode.Ecc, minVersion?: int, maxVersion?: int, mask?: int, boostEcl?: boolean): QrCode;
  15. readonly size: int;
  16. readonly mask: int;
  17. private readonly modules;
  18. private readonly isFunction;
  19. constructor(version: int, errorCorrectionLevel: QrCode.Ecc, dataCodewords: readonly byte[], msk: int);
  20. getModule(x: int, y: int): boolean;
  21. getModules(): boolean[][];
  22. private drawFunctionPatterns;
  23. private drawFormatBits;
  24. private drawVersion;
  25. private drawFinderPattern;
  26. private drawAlignmentPattern;
  27. private setFunctionModule;
  28. private addEccAndInterleave;
  29. private drawCodewords;
  30. private applyMask;
  31. private getPenaltyScore;
  32. private getAlignmentPatternPositions;
  33. private static getNumRawDataModules;
  34. private static getNumDataCodewords;
  35. private static reedSolomonComputeDivisor;
  36. private static reedSolomonComputeRemainder;
  37. private static reedSolomonMultiply;
  38. private finderPenaltyCountPatterns;
  39. private finderPenaltyTerminateAndCount;
  40. private finderPenaltyAddHistory;
  41. static readonly MIN_VERSION: int;
  42. static readonly MAX_VERSION: int;
  43. private static readonly PENALTY_N1;
  44. private static readonly PENALTY_N2;
  45. private static readonly PENALTY_N3;
  46. private static readonly PENALTY_N4;
  47. private static readonly ECC_CODEWORDS_PER_BLOCK;
  48. private static readonly NUM_ERROR_CORRECTION_BLOCKS;
  49. }
  50. export class QrSegment {
  51. readonly mode: QrSegment.Mode;
  52. readonly numChars: int;
  53. private readonly bitData;
  54. static makeBytes(data: readonly byte[]): QrSegment;
  55. static makeNumeric(digits: string): QrSegment;
  56. static makeAlphanumeric(text: string): QrSegment;
  57. static makeSegments(text: string): QrSegment[];
  58. static makeEci(assignVal: int): QrSegment;
  59. static isNumeric(text: string): boolean;
  60. static isAlphanumeric(text: string): boolean;
  61. constructor(mode: QrSegment.Mode, numChars: int, bitData: bit[]);
  62. getData(): bit[];
  63. static getTotalBits(segs: readonly QrSegment[], version: int): number;
  64. private static toUtf8ByteArray;
  65. private static readonly NUMERIC_REGEX;
  66. private static readonly ALPHANUMERIC_REGEX;
  67. private static readonly ALPHANUMERIC_CHARSET;
  68. }
  69. export {};
  70. }
  71. declare namespace qrcodegen.QrCode {
  72. type int = number;
  73. export class Ecc {
  74. readonly ordinal: int;
  75. readonly formatBits: int;
  76. static readonly LOW: Ecc;
  77. static readonly MEDIUM: Ecc;
  78. static readonly QUARTILE: Ecc;
  79. static readonly HIGH: Ecc;
  80. private constructor();
  81. }
  82. export {};
  83. }
  84. declare namespace qrcodegen.QrSegment {
  85. type int = number;
  86. export class Mode {
  87. readonly modeBits: int;
  88. private readonly numBitsCharCount;
  89. static readonly NUMERIC: Mode;
  90. static readonly ALPHANUMERIC: Mode;
  91. static readonly BYTE: Mode;
  92. static readonly KANJI: Mode;
  93. static readonly ECI: Mode;
  94. private constructor();
  95. numCharCountBits(ver: int): int;
  96. }
  97. export {};
  98. }
  99. export default qrcodegen;