Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Code128Reader

Decodes Code 128 barcodes.

author

Sean Owen

Hierarchy

Implements

Index

Properties

Static Private CODE_CODE_A

CODE_CODE_A: number = 101

Static Private CODE_CODE_B

CODE_CODE_B: number = 100

Static Private CODE_CODE_C

CODE_CODE_C: number = 99

Static Private CODE_FNC_1

CODE_FNC_1: number = 102

Static Private CODE_FNC_2

CODE_FNC_2: number = 97

Static Private CODE_FNC_3

CODE_FNC_3: number = 96

Static Private CODE_FNC_4_A

CODE_FNC_4_A: number = 101

Static Private CODE_FNC_4_B

CODE_FNC_4_B: number = 100

Static Private CODE_PATTERNS

CODE_PATTERNS: Int32Array[] = [Int32Array.from([2, 1, 2, 2, 2, 2]),Int32Array.from([2, 2, 2, 1, 2, 2]),Int32Array.from([2, 2, 2, 2, 2, 1]),Int32Array.from([1, 2, 1, 2, 2, 3]),Int32Array.from([1, 2, 1, 3, 2, 2]),Int32Array.from([1, 3, 1, 2, 2, 2]),Int32Array.from([1, 2, 2, 2, 1, 3]),Int32Array.from([1, 2, 2, 3, 1, 2]),Int32Array.from([1, 3, 2, 2, 1, 2]),Int32Array.from([2, 2, 1, 2, 1, 3]),Int32Array.from([2, 2, 1, 3, 1, 2]),Int32Array.from([2, 3, 1, 2, 1, 2]),Int32Array.from([1, 1, 2, 2, 3, 2]),Int32Array.from([1, 2, 2, 1, 3, 2]),Int32Array.from([1, 2, 2, 2, 3, 1]),Int32Array.from([1, 1, 3, 2, 2, 2]),Int32Array.from([1, 2, 3, 1, 2, 2]),Int32Array.from([1, 2, 3, 2, 2, 1]),Int32Array.from([2, 2, 3, 2, 1, 1]),Int32Array.from([2, 2, 1, 1, 3, 2]),Int32Array.from([2, 2, 1, 2, 3, 1]),Int32Array.from([2, 1, 3, 2, 1, 2]),Int32Array.from([2, 2, 3, 1, 1, 2]),Int32Array.from([3, 1, 2, 1, 3, 1]),Int32Array.from([3, 1, 1, 2, 2, 2]),Int32Array.from([3, 2, 1, 1, 2, 2]),Int32Array.from([3, 2, 1, 2, 2, 1]),Int32Array.from([3, 1, 2, 2, 1, 2]),Int32Array.from([3, 2, 2, 1, 1, 2]),Int32Array.from([3, 2, 2, 2, 1, 1]),Int32Array.from([2, 1, 2, 1, 2, 3]),Int32Array.from([2, 1, 2, 3, 2, 1]),Int32Array.from([2, 3, 2, 1, 2, 1]),Int32Array.from([1, 1, 1, 3, 2, 3]),Int32Array.from([1, 3, 1, 1, 2, 3]),Int32Array.from([1, 3, 1, 3, 2, 1]),Int32Array.from([1, 1, 2, 3, 1, 3]),Int32Array.from([1, 3, 2, 1, 1, 3]),Int32Array.from([1, 3, 2, 3, 1, 1]),Int32Array.from([2, 1, 1, 3, 1, 3]),Int32Array.from([2, 3, 1, 1, 1, 3]),Int32Array.from([2, 3, 1, 3, 1, 1]),Int32Array.from([1, 1, 2, 1, 3, 3]),Int32Array.from([1, 1, 2, 3, 3, 1]),Int32Array.from([1, 3, 2, 1, 3, 1]),Int32Array.from([1, 1, 3, 1, 2, 3]),Int32Array.from([1, 1, 3, 3, 2, 1]),Int32Array.from([1, 3, 3, 1, 2, 1]),Int32Array.from([3, 1, 3, 1, 2, 1]),Int32Array.from([2, 1, 1, 3, 3, 1]),Int32Array.from([2, 3, 1, 1, 3, 1]),Int32Array.from([2, 1, 3, 1, 1, 3]),Int32Array.from([2, 1, 3, 3, 1, 1]),Int32Array.from([2, 1, 3, 1, 3, 1]),Int32Array.from([3, 1, 1, 1, 2, 3]),Int32Array.from([3, 1, 1, 3, 2, 1]),Int32Array.from([3, 3, 1, 1, 2, 1]),Int32Array.from([3, 1, 2, 1, 1, 3]),Int32Array.from([3, 1, 2, 3, 1, 1]),Int32Array.from([3, 3, 2, 1, 1, 1]),Int32Array.from([3, 1, 4, 1, 1, 1]),Int32Array.from([2, 2, 1, 4, 1, 1]),Int32Array.from([4, 3, 1, 1, 1, 1]),Int32Array.from([1, 1, 1, 2, 2, 4]),Int32Array.from([1, 1, 1, 4, 2, 2]),Int32Array.from([1, 2, 1, 1, 2, 4]),Int32Array.from([1, 2, 1, 4, 2, 1]),Int32Array.from([1, 4, 1, 1, 2, 2]),Int32Array.from([1, 4, 1, 2, 2, 1]),Int32Array.from([1, 1, 2, 2, 1, 4]),Int32Array.from([1, 1, 2, 4, 1, 2]),Int32Array.from([1, 2, 2, 1, 1, 4]),Int32Array.from([1, 2, 2, 4, 1, 1]),Int32Array.from([1, 4, 2, 1, 1, 2]),Int32Array.from([1, 4, 2, 2, 1, 1]),Int32Array.from([2, 4, 1, 2, 1, 1]),Int32Array.from([2, 2, 1, 1, 1, 4]),Int32Array.from([4, 1, 3, 1, 1, 1]),Int32Array.from([2, 4, 1, 1, 1, 2]),Int32Array.from([1, 3, 4, 1, 1, 1]),Int32Array.from([1, 1, 1, 2, 4, 2]),Int32Array.from([1, 2, 1, 1, 4, 2]),Int32Array.from([1, 2, 1, 2, 4, 1]),Int32Array.from([1, 1, 4, 2, 1, 2]),Int32Array.from([1, 2, 4, 1, 1, 2]),Int32Array.from([1, 2, 4, 2, 1, 1]),Int32Array.from([4, 1, 1, 2, 1, 2]),Int32Array.from([4, 2, 1, 1, 1, 2]),Int32Array.from([4, 2, 1, 2, 1, 1]),Int32Array.from([2, 1, 2, 1, 4, 1]),Int32Array.from([2, 1, 4, 1, 2, 1]),Int32Array.from([4, 1, 2, 1, 2, 1]),Int32Array.from([1, 1, 1, 1, 4, 3]),Int32Array.from([1, 1, 1, 3, 4, 1]),Int32Array.from([1, 3, 1, 1, 4, 1]),Int32Array.from([1, 1, 4, 1, 1, 3]),Int32Array.from([1, 1, 4, 3, 1, 1]),Int32Array.from([4, 1, 1, 1, 1, 3]),Int32Array.from([4, 1, 1, 3, 1, 1]),Int32Array.from([1, 1, 3, 1, 4, 1]),Int32Array.from([1, 1, 4, 1, 3, 1]),Int32Array.from([3, 1, 1, 1, 4, 1]),Int32Array.from([4, 1, 1, 1, 3, 1]),Int32Array.from([2, 1, 1, 4, 1, 2]),Int32Array.from([2, 1, 1, 2, 1, 4]),Int32Array.from([2, 1, 1, 2, 3, 2]),Int32Array.from([2, 3, 3, 1, 1, 1, 2]),]

Static Private CODE_SHIFT

CODE_SHIFT: number = 98

Static Private CODE_START_A

CODE_START_A: number = 103

Static Private CODE_START_B

CODE_START_B: number = 104

Static Private CODE_START_C

CODE_START_C: number = 105

Static Private CODE_STOP

CODE_STOP: number = 106

Static Private MAX_AVG_VARIANCE

MAX_AVG_VARIANCE: number = 0.25

Static Private MAX_INDIVIDUAL_VARIANCE

MAX_INDIVIDUAL_VARIANCE: number = 0.7

Methods

decode

decodeRow

reset

  • reset(): void

Static Private decodeCode

  • decodeCode(row: BitArray, counters: Int32Array, rowOffset: number): number

Static Private findStartPattern

  • findStartPattern(row: BitArray): Int32Array

Static Protected patternMatchVariance

  • patternMatchVariance(counters: Int32Array, pattern: Int32Array, maxIndividualVariance: number): number
  • Determines how closely a set of observed counts of runs of black/white values matches a given target pattern. This is reported as the ratio of the total variance from the expected pattern proportions across all pattern elements, to the length of the pattern.

    Parameters

    • counters: Int32Array

      observed counters

    • pattern: Int32Array

      expected pattern

    • maxIndividualVariance: number

      The most any counter can differ before we give up

    Returns number

    ratio of total variance between counters and pattern compared to total pattern size

Static Protected recordPattern

  • recordPattern(row: BitArray, start: number, counters: Int32Array): void
  • Records the size of successive runs of white and black pixels in a row, starting at a given point. The values are recorded in the given array, and the number of runs recorded is equal to the size of the array. If the row starts on a white pixel at the given start point, then the first count recorded is the run of white pixels starting from that point; likewise it is the count of a run of black pixels if the row begin on a black pixels at that point.

    throws

    NotFoundException if counters cannot be filled entirely from row before running out of pixels

    Parameters

    • row: BitArray

      row to count from

    • start: number

      offset into row to start at

    • counters: Int32Array

      array into which to record counts

    Returns void

Static Protected recordPatternInReverse

  • recordPatternInReverse(row: BitArray, start: number, counters: Int32Array): void

Generated using TypeDoc