Members
(constant) CHAR_TO_ORD :Object.<{}>
ISO/IEC 18004:2000 Table 5
Type:
- Object.<{}>
- Source:
(constant) ECC_L
from EccLevel
- Source:
(constant) IS_DARK :number|int
Type:
- number | int
- Source:
(constant) MASK_PATTERN_AUTO :number|int
Type:
- number | int
- Source:
(protected, constant) MATRIX_NEIGHBOURS :Array.<Array.<number>>|Array.<Array.<int>>
Map of flag => coord
Type:
- Array.<Array.<number>> | Array.<Array.<int>>
- Source:
- See:
-
- QRMatrix::checkNeighbours()
(constant) MATRIX_NEIGHBOUR_FLAGS :Array.<number>|Array.<int>
Type:
- Array.<number> | Array.<int>
- Source:
(constant) MODE_INTERFACES :Array.<string>
Map of data mode => interface (detection order)
Type:
- Array.<string>
(constant) MODE_LENGTH_BITS
mode length bits for the version breakpoints 1-9, 10-26 and 27-40
ISO/IEC 18004:2000 Table 3 - Number of bits in Character Count Indicator
- Source:
(constant) MODE_NUMBER
from Mode
- Source:
(constant) MODULE_VALUES_KEYS :Array.<number>|Array.<int>
Type:
- Array.<number> | Array.<int>
- Source:
(constant) M_ALIGNMENT :number|int
Type:
- number | int
- Source:
(constant) M_ALIGNMENT_DARK :number|int
Type:
- number | int
- Source:
(constant) M_DARKMODULE :number|int
Type:
- number | int
- Source:
(constant) M_DARKMODULE_LIGHT :number|int
Type:
- number | int
- Source:
(constant) M_DATA :number|int
Type:
- number | int
- Source:
(constant) M_DATA_DARK :number|int
Type:
- number | int
- Source:
(constant) M_FINDER :number|int
Type:
- number | int
- Source:
(constant) M_FINDER_DARK :number|int
Type:
- number | int
- Source:
(constant) M_FINDER_DOT :number|int
Type:
- number | int
- Source:
(constant) M_FINDER_DOT_LIGHT :number|int
Type:
- number | int
- Source:
(constant) M_FORMAT :number|int
Type:
- number | int
- Source:
(constant) M_FORMAT_DARK :number|int
Type:
- number | int
- Source:
(constant) M_LOGO :number|int
Type:
- number | int
- Source:
(constant) M_LOGO_DARK :number|int
Type:
- number | int
- Source:
(constant) M_NULL :number|int
Type:
- number | int
- Source:
(constant) M_QUIETZONE :number|int
Type:
- number | int
- Source:
(constant) M_QUIETZONE_DARK :number|int
Type:
- number | int
- Source:
(constant) M_SEPARATOR :number|int
Type:
- number | int
- Source:
(constant) M_SEPARATOR_DARK :number|int
Type:
- number | int
- Source:
(constant) M_TIMING :number|int
Type:
- number | int
- Source:
(constant) M_TIMING_DARK :number|int
Type:
- number | int
- Source:
(constant) M_VERSION :number|int
Type:
- number | int
- Source:
(constant) M_VERSION_DARK :number|int
Type:
- number | int
- Source:
(constant) TOTAL_CODEWORDS :Array.<number>|Array.<int>
Type:
- Array.<number> | Array.<int>
- Source:
(constant) VERSION_AUTO :number|int
Type:
- number | int
- Source:
Methods
(protected) _fromIterable($options) → {void}
Parameters:
Name | Type | Description |
---|---|---|
$options |
Object.<{}> |
- Source:
Returns:
- Type
- void
(protected) _set_canvasMimeType($canvasImageType) → {void}
set canvas image type
Parameters:
Name | Type | Description |
---|---|---|
$canvasImageType |
string |
- Source:
Returns:
- Type
- void
(protected) _set_circleRadius($circleRadius) → {void}
clamp/set SVG circle radius
Parameters:
Name | Type | Description |
---|---|---|
$circleRadius |
number | float |
- Source:
Returns:
- Type
- void
(protected) _set_eccLevel($eccLevel) → {void}
sets the error correction level
Parameters:
Name | Type | Description |
---|---|---|
$eccLevel |
number | int |
- Source:
Throws:
QRCodeException
Returns:
- Type
- void
(protected) _set_logoSpaceHeight($height) → {void}
clamp/set logo space height
Parameters:
Name | Type | Description |
---|---|---|
$height |
number | int |
- Source:
Returns:
- Type
- void
(protected) _set_logoSpaceStartX($startX) → {void}
clamp/set horizontal logo space start
Parameters:
Name | Type | Description |
---|---|---|
$startX |
number | int | null |
- Source:
Returns:
- Type
- void
(protected) _set_logoSpaceStartY($startY) → {void}
clamp/set vertical logo space start
Parameters:
Name | Type | Description |
---|---|---|
$startY |
number | int | null |
- Source:
Returns:
- Type
- void
(protected) _set_logoSpaceWidth($width) → {void}
clamp/set logo space width
Parameters:
Name | Type | Description |
---|---|---|
$width |
number | int |
- Source:
Returns:
- Type
- void
(protected) _set_maskPattern($maskPattern) → {void}
sets/clamps the mask pattern
Parameters:
Name | Type | Description |
---|---|---|
$maskPattern |
number | int |
- Source:
Returns:
- Type
- void
(protected) _set_quietzoneSize($quietzoneSize) → {void}
sets/clamps the quiet zone size
Parameters:
Name | Type | Description |
---|---|---|
$quietzoneSize |
number | int |
- Source:
Returns:
- Type
- void
(protected) _set_version($version) → {void}
sets/clamps the version number
Parameters:
Name | Type | Description |
---|---|---|
$version |
number | int |
- Source:
Returns:
- Type
- void
(protected) _set_versionMax($versionMax) → {void}
sets the maximum version number
Parameters:
Name | Type | Description |
---|---|---|
$versionMax |
number | int |
- Source:
Returns:
- Type
- void
(protected) _set_versionMin($versionMin) → {void}
sets the minimum version number
Parameters:
Name | Type | Description |
---|---|---|
$versionMin |
number | int |
- Source:
Returns:
- Type
- void
addAlphaNumSegment() → {QRCode}
Adds an alphanumeric data segment
ISO/IEC 18004:2000 8.3.3 - Alphanumeric Mode
Returns:
- Type
- QRCode
addByteSegment() → {QRCode}
Adds an 8-bit byte data segment
ISO/IEC 18004:2000 8.3.4 - 8-bit Byte Mode
Returns:
- Type
- QRCode
(protected) addMatrixModifications($QRMatrix) → {QRMatrix}
add matrix modifications after mask pattern evaluation and before handing over to output
Parameters:
Name | Type | Description |
---|---|---|
$QRMatrix |
QRMatrix |
Returns:
- Type
- QRMatrix
addNumericSegment() → {QRCode}
Adds a numeric data segment
ISO/IEC 18004:2000 8.3.2 - Numeric Mode
Returns:
- Type
- QRCode
addSegment() → {QRCode}
Adds a data segment
ISO/IEC 18004:2000 8.3.6 - Mixing modes
ISO/IEC 18004:2000 Annex H - Optimisation of bit stream length
Returns:
- Type
- QRCode
ansi8($str, $color, $background) → {string}
Parameters:
Name | Type | Default | Description |
---|---|---|---|
$str |
string | ||
$color |
number | int | ||
$background |
boolean | null |
- Source:
Returns:
- Type
- string
array_combine(keys, values) → {Object.<{}>|boolean}
Parameters:
Name | Type | Description |
---|---|---|
keys |
Array | |
values |
Array |
- Source:
Returns:
- Type
- Object.<{}> | boolean
array_fill($count, $value) → {Array}
not an exact implementation, we're ignoring the $start_index parameter, which is always 0 here
Parameters:
Name | Type | Description |
---|---|---|
$count |
number | int | |
$value |
* |
- Source:
Returns:
- Type
- Array
check($x, $y) → {boolean}
Checks whether a module is true (dark) or false (light)
Also, returns false if the given coordinates are out of range.
true => $value & 0x800 === 0x800
false => $value & 0x800 === 0
Parameters:
Name | Type | Description |
---|---|---|
$x |
number | int | |
$y |
number | int |
- Source:
Returns:
- Type
- boolean
checkNeighbours($x, $y, $M_TYPE) → {number|int}
Checks the status neighbouring modules of the given module at ($x, $y) and returns a bitmask with the results.
The 8 flags of the bitmask represent the status of each of the neighbouring fields,
starting with the lowest bit for top left, going clockwise:
0 1 2
7 # 3
6 5 4
Parameters:
Name | Type | Default | Description |
---|---|---|---|
$x |
number | int | ||
$y |
number | int | ||
$M_TYPE |
number | int | null | null |
- Source:
Returns:
- Type
- number | int
checkType($x, $y, $M_TYPE) → {boolean}
Checks whether a module is of the given $M_TYPE
true => $value & $M_TYPE === $M_TYPE
Also, returns false if the given coordinates are out of range.
Parameters:
Name | Type | Description |
---|---|---|
$x |
number | int | |
$y |
number | int | |
$M_TYPE |
number | int |
- Source:
Returns:
- Type
- boolean
checkTypeIn($x, $y, $M_TYPES) → {boolean}
Checks whether the module at ($x, $y) is in the given array of $M_TYPES,
returns true if a match is found, otherwise false.
Parameters:
Name | Type | Description |
---|---|---|
$x |
number | int | |
$y |
number | int | |
$M_TYPES |
Array.<number> | Array.<int> |
- Source:
Returns:
- Type
- boolean
(protected) clampLogoSpaceValue($value) → {number|int}
clamp the logo space values between 0 and maximum length (177 modules at version 40)
Parameters:
Name | Type | Description |
---|---|---|
$value |
number | int |
- Source:
Returns:
- Type
- number | int
clear() → {BitBuffer}
clears the buffer
- Source:
Returns:
- Type
- BitBuffer
clearSegments() → {QRCode}
Clears the data segments array
Returns:
- Type
- QRCode
clone($object) → {Object.<*>}
Parameters:
Name | Type | Description |
---|---|---|
$object |
Object.<*> |
- Source:
Returns:
- Type
- Object.<*>
(protected) collectModules($transform) → {Object.<{}>}
collects the modules per QRMatrix.M_* type and runs a $transform functio on each module and
returns an array with the transformed modules
The transform callback is called with the following parameters:
$x - current column
$y - current row
$M_TYPE - field value
$M_TYPE_LAYER - (possibly modified) field value that acts as layer id
Parameters:
Name | Type | Description |
---|---|---|
$transform |
function |
- Source:
Returns:
- Type
- Object.<{}>
(protected) createMarkup()
- Source:
(protected) createMatrix($size, $value) → {Object.<{}>}
Creates a 2-dimensional array (square) of the given $size
Parameters:
Name | Type | Description |
---|---|---|
$size |
number | int | |
$value |
number | int |
- Source:
Returns:
- Type
- Object.<{}>
(protected) drawImage() → {void}
- Source:
Returns:
- Type
- void
dump() → {HTMLCanvasElement|string|*}
- Source:
Throws:
QRCodeOutputException
Returns:
- Type
- HTMLCanvasElement | string | *
dump() → {HTMLElement|SVGElement|ChildNode|string|*}
- Source:
Returns:
- Type
- HTMLElement | SVGElement | ChildNode | string | *
(abstract) dump($file) → {*}
generates the output, optionally dumps it to a file, and returns it
Parameters:
Name | Type | Default | Description |
---|---|---|---|
$file |
string | null | null |
- Source:
Returns:
- Type
- *
dump()
- Source:
dump()
- Source:
exp($a) → {number|int}
Parameters:
Name | Type | Description |
---|---|---|
$a |
number | int |
- Source:
Returns:
2 to the power of a in GF(size)
- Type
- number | int
flip($x, $y) → {QRMatrix}
Flips the value of the module
Parameters:
Name | Type | Description |
---|---|---|
$x |
number | int | |
$y |
number | int |
- Source:
Returns:
- Type
- QRMatrix
get($x, $y) → {number|int}
Returns the value of the module at position [$x, $y] or -1 if the coordinate is outside of the matrix
Parameters:
Name | Type | Description |
---|---|---|
$x |
number | int | |
$y |
number | int |
- Source:
Returns:
- Type
- number | int
getAlignmentPattern() → {Array.<number>|Array.<int>}
the alignment patterns for the current version
- Source:
Returns:
- Type
- Array.<number> | Array.<int>
getBestPattern($QRMatrix) → {MaskPattern}
Evaluates the matrix of the given data interface and returns a new mask pattern instance for the best result
Parameters:
Name | Type | Description |
---|---|---|
$QRMatrix |
QRMatrix |
- Source:
Returns:
- Type
- MaskPattern
getBuffer() → {Array.<number>|Array.<int>}
returns the buffer content
- Source:
Returns:
- Type
- Array.<number> | Array.<int>
(protected) getCharCount() → {number|int}
returns the character count of the $data string
- Source:
Returns:
- Type
- number | int
getCoefficient($degree) → {number|int}
Parameters:
Name | Type | Description |
---|---|---|
$degree |
number | int |
- Source:
Returns:
$coefficient of x^degree term in this polynomial
- Type
- number | int
getCoefficients() → {Array.<number>|Array.<int>}
- Source:
Returns:
- Type
- Array.<number> | Array.<int>
(protected) getCssClass()
- Source:
getDataMode() → {number|int}
returns the current data mode constant
- Source:
Returns:
- Type
- number | int
(abstract) getDataMode() → {number|int}
returns the current data mode constant
- Source:
Returns:
- Type
- number | int
getDefaultModuleValue()
- Source:
(protected) getDefaultModuleValue($isDark)
Returns a defualt value for either dark or light modules (return value depends on the output module)
Parameters:
Name | Type | Description |
---|---|---|
$isDark |
boolean |
- Source:
getDefaultModuleValue()
- Source:
getDegree() → {number|int}
- Source:
Returns:
$degree of this polynomial
- Type
- number | int
getDimension() → {number|int}
the matrix size for the given version
- Source:
Returns:
- Type
- number | int
getEccLevel() → {EccLevel}
Returns the current ECC level instance
- Source:
Returns:
- Type
- EccLevel
getLength() → {number|int}
returns the current buffer length
- Source:
Returns:
- Type
- number | int
getLengthBitsForMode($mode)
returns the array of length bits for the given mode
Parameters:
Name | Type | Description |
---|---|---|
$mode |
number | int |
- Source:
getLengthBitsForVersion($mode, $version) → {number|int}
returns the length bits for the version breakpoints 1-9, 10-26 and 27-40
Parameters:
Name | Type | Description |
---|---|---|
$mode |
number | int | |
$version |
number | int |
- Source:
Throws:
QRCodeException
Returns:
- Type
- number | int
(protected) getLengthBitsForVersion($versionNumber) → {number|int}
Parameters:
Name | Type | Description |
---|---|---|
$versionNumber |
number | int |
- Source:
Returns:
- Type
- number | int
getLengthInBits()
- Source:
getLengthInBits()
- Source:
getLengthInBits()
- Source:
(abstract) getLengthInBits() → {number|int}
retruns the length in bits of the data string
- Source:
Returns:
- Type
- number | int
getLevel() → {number|int}
returns the current ECC level
- Source:
Returns:
- Type
- number | int
getMask() → {function}
Returns a closure that applies the mask for the chosen mask pattern.
Note that the diagram in section 6.8.1 is misleading since it indicates that i is column position
and j is row position. In fact, as the text says, i is row position and j is column position.
- Source:
- See:
Returns:
- Type
- function
getMaskPattern() → {MaskPattern}
Returns the current mask pattern instance
- Source:
Returns:
- Type
- MaskPattern
getMatrix($boolean) → {Array.<Array.<number>>|Array.<Array.<int>>|Array.<Array.<boolean>>}
Returns the data matrix, returns a pure boolean representation if $boolean is set to true
Parameters:
Name | Type | Default | Description |
---|---|---|---|
$boolean |
boolean | false |
- Source:
Returns:
- Type
- Array.<Array.<number>> | Array.<Array.<int>> | Array.<Array.<boolean>>
getMaxBits() → {Array.<number>|Array.<int>}
- Source:
Returns:
an array with the max bit lengths for version 1-40 and the current ECC level
- Type
- Array.<number> | Array.<int>
getMaxBitsForVersion($version) → {number|int}
Returns the maximum bit length for the given version and current ECC level
Parameters:
Name | Type | Description |
---|---|---|
$version |
Version |
- Source:
Returns:
- Type
- number | int
(protected) getModuleValue($M_TYPE)
Returns the prepared value for the given $M_TYPE
Parameters:
Name | Type | Description |
---|---|---|
$M_TYPE |
number | int |
- Source:
Throws:
-
if $moduleValues[$M_TYPE] doesn't exist
- Type
- QRCodeOutputException
(protected) getModuleValueAt($x, $y)
Returns the prepared module value at the given coordinate [$x, $y] (convenience)
Parameters:
Name | Type | Description |
---|---|---|
$x |
number | int | |
$y |
number | int |
- Source:
getOrdinal()
returns the ordinal value of the current ECC level
references to the keys of the following tables:
- Source:
- See:
-
- MAX_BITS
- FORMAT_PATTERN
- RSBLOCKS
getOutputDimensions()
- Source:
(protected) getOutputDimensions()
Returns a 2 element array with the current output width and height
The type and units of the values depend on the output class. The default value is the current module count.
- Source:
getPattern() → {number|int}
Returns the current mask pattern
- Source:
Returns:
- Type
- number | int
getQRMatrix() → {QRMatrix}
Returns a QRMatrix object for the given $data and current QROptions
Throws:
QRCodeDataException
Returns:
- Type
- QRMatrix
getRSBlocks($eccLevel) → {Array}
returns ECC block information for the given $version and $eccLevel
Parameters:
Name | Type | Description |
---|---|---|
$eccLevel |
EccLevel |
- Source:
Returns:
- Type
- Array
getSize() → {number|int}
Returns the absoulute size of the matrix, including quiet zone (after setting it).
size = version * 4 + 17 [ + 2 * quietzone size]
- Source:
Returns:
- Type
- number | int
getTotalCodewords() → {number|int}
returns the maximum codewords for the current version
- Source:
Returns:
- Type
- number | int
getVersion() → {Version}
Returns the current version instance
- Source:
Returns:
- Type
- Version
getVersionNumber() → {number|int}
returns the current version number
- Source:
Returns:
- Type
- number | int
getVersionPattern() → {number|int|null}
the version pattern for the given version
- Source:
Returns:
- Type
- number | int | null
(protected) getViewBox() → {string}
returns the value for the SVG viewBox attribute
- Source:
- See:
Returns:
- Type
- string
getformatPattern($maskPattern) → {number|int}
returns the format pattern for the given $eccLevel and $maskPattern
Parameters:
Name | Type | Description |
---|---|---|
$maskPattern |
MaskPattern |
- Source:
Returns:
- Type
- number | int
(protected) header() → {string}
returns the
- Source:
Returns:
- Type
- string
initFunctionalPatterns() → {QRMatrix}
shortcut to initialize the functional patterns
- Source:
Returns:
- Type
- QRMatrix
(protected) initOutputInterface($QRMatrix) → {QROutputAbstract}
initializes a fresh built-in or custom QROutputInterface
Parameters:
Name | Type | Description |
---|---|---|
$QRMatrix |
QRMatrix |
Throws:
QRCodeOutputException
Returns:
- Type
- QROutputAbstract
interleaveEcBytes($bitBuffer) → {Object.<{}>}
ECC interleaving
Parameters:
Name | Type | Description |
---|---|---|
$bitBuffer |
BitBuffer |
- Source:
Throws:
QRCodeException
Returns:
- Type
- Object.<{}>
intval($var, $base) → {number|int}
Parameters:
Name | Type | Default | Description |
---|---|---|---|
$var |
* | ||
$base |
number | null | null |
- Source:
Returns:
- Type
- number | int
invert() → {QRMatrix}
Inverts the values of the whole matrix
ISO/IEC 18004:2015 Section 6.2 - Reflectance reversal
- Source:
Returns:
- Type
- QRMatrix
isDark($M_TYPE) → {boolean}
Checks whether the given $M_TYPE is a dark value
Parameters:
Name | Type | Description |
---|---|---|
$M_TYPE |
number | int |
- Source:
Returns:
- Type
- boolean
isZero() → {boolean}
- Source:
Returns:
true if this polynomial is the monomial "0"
- Type
- boolean
isset($accessor)
Checks to see if a value in a nested array is set.
isset(() => some.nested.value)
Parameters:
Name | Type | Description |
---|---|---|
$accessor |
function | Function that returns our value |
- Source:
log($a) → {number|int}
Parameters:
Name | Type | Description |
---|---|---|
$a |
number | int |
- Source:
Throws:
QRCodeException
Returns:
base 2 log of a in GF(size)
- Type
- number | int
mask($maskPattern) → {QRMatrix}
Applies/reverses the mask pattern
ISO/IEC 18004:2000 Section 8.8.1
Parameters:
Name | Type | Description |
---|---|---|
$maskPattern |
MaskPattern |
- Source:
Returns:
- Type
- QRMatrix
mod($other) → {GenericGFPoly}
Parameters:
Name | Type | Description |
---|---|---|
$other |
GenericGFPoly |
- Source:
Returns:
- Type
- GenericGFPoly
(protected) module() → {void}
- Source:
Returns:
- Type
- void
(protected) module($x, $y, $M_TYPE) → {string}
returns a path segment for a single module
Parameters:
Name | Type | Description |
---|---|---|
$x |
number | int | |
$y |
number | int | |
$M_TYPE |
number | int |
- Source:
- See:
Returns:
- Type
- string
(protected) module() → {*}
Creates an array element for a single module
- Source:
Returns:
- Type
- *
moduleValueIsValid()
- Source:
moduleValueIsValid()
- Source:
(abstract) moduleValueIsValid($value) → {boolean}
Determines whether the given value is valid
Parameters:
Name | Type | Description |
---|---|---|
$value |
* |
- Source:
Returns:
- Type
- boolean
moduleValueIsValid()
- Source:
multiply($a, $b)
Parameters:
Name | Type | Description |
---|---|---|
$a |
number | int | |
$b |
number | int |
- Source:
Returns:
int product of a and b in GF(size)
multiply($other) → {GenericGFPoly}
Parameters:
Name | Type | Description |
---|---|---|
$other |
GenericGFPoly |
- Source:
Returns:
- Type
- GenericGFPoly
ord($string) → {number|int}
Parameters:
Name | Type | Description |
---|---|---|
$string |
string |
- Source:
Returns:
- Type
- number | int
(protected) path($path, $M_TYPE) → {string}
renders and returns a single element
Parameters:
Name | Type | Description |
---|---|---|
$path |
string | |
$M_TYPE |
number | int |
- Source:
- See:
Returns:
- Type
- string
(protected) paths() → {string}
returns one or more SVG elements
- Source:
- See:
Returns:
- Type
- string
prepareModuleValue()
- Source:
(protected) prepareModuleValue($value)
Returns the final value for the given input (return value depends on the output module)
Parameters:
Name | Type | Description |
---|---|---|
$value |
* |
- Source:
prepareModuleValue()
- Source:
put($bits, $length) → {BitBuffer}
appends a sequence of bits
Parameters:
Name | Type | Description |
---|---|---|
$bits |
number | int | |
$length |
number | int |
- Source:
Returns:
- Type
- BitBuffer
putBit($bit) → {BitBuffer}
appends a single bit
Parameters:
Name | Type | Description |
---|---|---|
$bit |
boolean |
- Source:
Returns:
- Type
- BitBuffer
render() → {*}
Renders a QR Code for the given $data and QROptions
Returns:
- Type
- *
renderMatrix($QRMatrix, $file) → {*}
Renders a QR Code for the given QRMatrix and QROptions, saves $file optionally
Parameters:
Name | Type | Default | Description |
---|---|---|---|
$QRMatrix |
QRMatrix | ||
$file |
string | null | null |
Returns:
- Type
- *
rotate90()
Rotates the matrix by 90 degrees clock wise
- Source:
(protected) row() → {*}
Creates an array element for a matrix row
- Source:
Returns:
- Type
- *
(protected) saveToFile($data, $file) → {void}
saves the qr data to a file
Parameters:
Name | Type | Description |
---|---|---|
$data |
string | |
$file |
string |
- Source:
- See:
-
- file_put_contents()
- QROptions.cachefile
Throws:
QRCodeOutputException
Returns:
- Type
- void
set($x, $y, $value, $M_TYPE) → {QRMatrix}
Sets the $M_TYPE value for the module at position [$x, $y]
true => $M_TYPE | 0x800
false => $M_TYPE
Parameters:
Name | Type | Description |
---|---|---|
$x |
number | int | |
$y |
number | int | |
$value |
boolean | |
$M_TYPE |
number | int |
- Source:
Returns:
- Type
- QRMatrix
setAlignmentPattern() → {QRMatrix}
Draws the 5x5 alignment patterns
ISO/IEC 18004:2000 Section 7.3.5
- Source:
Returns:
- Type
- QRMatrix
setArea($startX, $startY, $width, $height, $value, $M_TYPE) → {QRMatrix}
Fills an area of $width * $height, from the given starting point [$startX, $startY] (top left) with $value for $M_TYPE.
Parameters:
Name | Type | Description |
---|---|---|
$startX |
number | int | |
$startY |
number | int | |
$width |
number | int | |
$height |
number | int | |
$value |
boolean | |
$M_TYPE |
number | int |
- Source:
Returns:
- Type
- QRMatrix
setDarkModule() → {QRMatrix}
Sets the "dark module", that is always on the same position 1x1px away from the bottom left finder
4 * version + 9 or moduleCount - 8
- Source:
Returns:
- Type
- QRMatrix
setData($dataSegments) → {QRData}
Sets the data string (internally called by the constructor)
Parameters:
Name | Type | Description |
---|---|---|
$dataSegments |
Array.<QRDataModeAbstract> |
- Source:
Returns:
- Type
- QRData
setFinderPattern() → {QRMatrix}
Draws the 7x7 finder patterns in the corners top left/right and bottom left
ISO/IEC 18004:2000 Section 7.3.2
- Source:
Returns:
- Type
- QRMatrix
setFormatInfo($maskPattern) → {QRMatrix}
Draws the format info along the finder patterns. If no $maskPattern, all format info modules will be set to false.
ISO/IEC 18004:2000 Section 8.9
Parameters:
Name | Type | Default | Description |
---|---|---|---|
$maskPattern |
MaskPattern | null | null |
- Source:
Returns:
- Type
- QRMatrix
setLogoSpace($width, $height, $startX, $startY) → {QRMatrix}
Clears a space of $width * $height in order to add a logo or text.
If no $height is given, the space will be assumed a square of $width.
Additionally, the logo space can be positioned within the QR Code using $startX and $startY.
If either of these are null, the logo space will be centered in that direction.
ECC level "H" (30%) is required.
The coordinates of $startX and $startY do not include the quiet zone:
[0, 0] is always the top left module of the top left finder pattern, negative values go into the quiet zone top and left.
Please note that adding a logo space minimizes the error correction capacity of the QR Code and
created images may become unreadable, especially when printed with a chance to receive damage.
Please test thoroughly before using this feature in production.
This method should be called from within an output module (after the matrix has been filled with data).
Note that there is no restiction on how many times this method could be called on the same matrix instance.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
$width |
number | int | ||
$height |
number | int | null | null | |
$startX |
number | int | null | null | |
$startY |
number | int | null | null |
- Source:
Throws:
QRCodeDataException
Returns:
- Type
- QRMatrix
(protected) setMatrixDimensions() → {void}
Sets/updates the matrix dimensions
Call this method if you modify the matrix from within your custom module in case the dimensions have been changed
- Source:
Returns:
- Type
- void
(protected) setMinMaxVersion($versionMin, $versionMax) → {void}
clamp min/max version number
Parameters:
Name | Type | Description |
---|---|---|
$versionMin |
number | int | |
$versionMax |
number | int |
- Source:
Returns:
- Type
- void
(protected) setModuleValues() → {void}
Sets the initial module values
- Source:
Returns:
- Type
- void
setOptions($options) → {QRCode}
Sets an options instance
Parameters:
Name | Type | Description |
---|---|---|
$options |
QROptions |
Returns:
- Type
- QRCode
setQuietZone($quietZoneSize) → {QRMatrix}
Draws the "quiet zone" of $size around the matrix
ISO/IEC 18004:2000 Section 7.3.7
Parameters:
Name | Type | Description |
---|---|---|
$quietZoneSize |
number | int |
- Source:
Throws:
QRCodeDataException
Returns:
- Type
- QRMatrix
setSeparators() → {QRMatrix}
Draws the separator lines around the finder patterns
ISO/IEC 18004:2000 Section 7.3.3
- Source:
Returns:
- Type
- QRMatrix
setTimingPattern() → {QRMatrix}
Draws the timing pattern (h/v checkered line between the finder patterns)
ISO/IEC 18004:2000 Section 7.3.4
- Source:
Returns:
- Type
- QRMatrix
setVersionNumber() → {QRMatrix}
Draws the version information, 2x 3x6 pixel
ISO/IEC 18004:2000 Section 8.10
- Source:
Returns:
- Type
- QRMatrix
testRule1($matrix, $height, $width) → {number|int}
Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and
give penalty to them. Example: 00000 or 11111.
Parameters:
Name | Type | Description |
---|---|---|
$matrix |
Array | |
$height |
number | int | |
$width |
number | int |
- Source:
Returns:
- Type
- number | int
testRule2($matrix, $height, $width) → {number|int}
Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give
penalty to them. This is actually equivalent to the spec's rule, which is to find MxN blocks and give a
penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block.
Parameters:
Name | Type | Description |
---|---|---|
$matrix |
Array | |
$height |
number | int | |
$width |
number | int |
- Source:
Returns:
- Type
- number | int
testRule3($matrix, $height, $width) → {number|int}
Apply mask penalty rule 3 and return the penalty. Find consecutive runs of 1:1:3:1:1:4
starting with black, or 4:1:1:3:1:1 starting with white, and give penalty to them. If we
find patterns like 000010111010000, we give penalty once.
Parameters:
Name | Type | Description |
---|---|---|
$matrix |
Array | |
$height |
number | int | |
$width |
number | int |
- Source:
Returns:
- Type
- number | int
testRule4($matrix, $height, $width) → {number|int}
Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give
penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.
Parameters:
Name | Type | Description |
---|---|---|
$matrix |
Array | |
$height |
number | int | |
$width |
number | int |
- Source:
Returns:
- Type
- number | int
(protected) toBase64DataURI($data, $mime) → {string}
Parameters:
Name | Type | Description |
---|---|---|
$data |
string | (ignored) |
$mime |
string | (ignored) |
- Source:
Returns:
- Type
- string
(protected) toBase64DataURI($data, $mime)
Returns a base64 data URI for the given string and mime type
Parameters:
Name | Type | Description |
---|---|---|
$data |
string | |
$mime |
string |
- Source:
Throws:
QRCodeOutputException
toString() → {string}
returns the string representation of the current ECC level
- Source:
Returns:
- Type
- string
toString() → {string}
returns the current version number as string
- Source:
Returns:
- Type
- string
validateString()
- Source:
validateString()
- Source:
validateString()
- Source:
(abstract) validateString($string) → {boolean}
checks if the given string qualifies for the encoder module
Parameters:
Name | Type | Description |
---|---|---|
$string |
string |
- Source:
Returns:
- Type
- boolean
write()
- Source:
write()
- Source:
write()
- Source:
(abstract) write($bitBuffer, $versionNumber) → {void}
writes the actual data string to the BitBuffer, uses the given version to determine the length bits
Parameters:
Name | Type | Description |
---|---|---|
$bitBuffer |
BitBuffer | |
$versionNumber |
number | int |
- Source:
- See:
-
- QRData::writeBitBuffer()
Returns:
- Type
- void
writeCodewords($bitBuffer) → {QRMatrix}
Maps the interleaved binary $data on the matrix
Parameters:
Name | Type | Description |
---|---|---|
$bitBuffer |
BitBuffer |
- Source:
Returns:
- Type
- QRMatrix
writeMatrix() → {QRMatrix}
returns a fresh matrix object with the data written and masked with the given $maskPattern
- Source:
Returns:
- Type
- QRMatrix