|
| 1 | +# `QRMatrix` |
| 2 | + |
| 3 | +The full phpDocumentor API documentation can be found at [chillerlan.github.io/php-qrcode](https://chillerlan.github.io/php-qrcode/classes/chillerlan-QRCode-Data-QRMatrix.html). |
| 4 | + |
| 5 | +## Methods |
| 6 | +<!-- using non-breaking spaces chr(255) in the longest method signature to force the silly table to stretch --> |
| 7 | +| method | return | description | |
| 8 | +|----------------------------------------------------------------------------------------|---------------------|----------------------------------------------------------------------------------------------------------------------------| |
| 9 | +| `__construct(Version $version, EccLevel $eccLevel)` | - | | |
| 10 | +| `initFunctionalPatterns()` | `self` | shortcut to initialize the functional patterns | |
| 11 | +| `getMatrix()` | `array` | the internal matrix representation as a 2 dimensional array | |
| 12 | +| `getVersion()` | `Version\|null` | the current QR Code version instance | |
| 13 | +| `getEccLevel()` | `EccLevel\|null` | the current ECC level instance | |
| 14 | +| `getMaskPattern()` | `MaskPattern\|null` | the used mask pattern instance | |
| 15 | +| `getSize()` | `int` | the absoulute size of the matrix, including quiet zone (if set). `$version * 4 + 17 + 2 * $quietzone` | |
| 16 | +| `get(int $x, int $y)` | `int` | returns the value of the module | |
| 17 | +| `set(int $x, int $y, bool $value, int $M_TYPE)` | `self` | sets the `$M_TYPE` value for the module | |
| 18 | +| `setArea(int $startX, int $startY, int $width, int $height, bool $value, int $M_TYPE)` | `self` | Fills an area of $width * $height, from the given starting point $startX, $startY (top left) with $value for $M_TYPE | |
| 19 | +| `checkType(int $x, int $y, int $M_TYPE)` | `bool` | Checks whether a module is of the given $M_TYPE | |
| 20 | +| `checkTypeIn(int $x, int $y, array $M_TYPES)` | `bool` | Checks whether the module at ($x, $y) is in the given array of $M_TYPES, returns true if a match is found, otherwise false | |
| 21 | +| `check(int $x, int $y)` | `bool` | checks whether a module is true (dark) or false (light) | |
| 22 | +| `checkNeighbours(int $x, int $y, int $M_TYPE = null)` | `int` | Checks the status neighbouring modules of the given module at ($x, $y) and returns a bitmask with the results. | |
| 23 | +| `setDarkModule()` | `self` | | |
| 24 | +| `setFinderPattern()` | `self` | | |
| 25 | +| `setSeparators()` | `self` | | |
| 26 | +| `setAlignmentPattern()` | `self` | | |
| 27 | +| `setTimingPattern()` | `self` | | |
| 28 | +| `setVersionNumber()` | `self` | | |
| 29 | +| `setFormatInfo(MaskPattern $maskPattern = null)` | `self` | | |
| 30 | +| `setQuietZone(int $quietZoneSize)` | `self` | Draws the "quiet zone" of $quietZoneSize around the matrix | |
| 31 | +| `rotate90()` | `self` | Rotates the matrix by 90 degrees clock wise | |
| 32 | +| `setLogoSpace(int $width, int $height = null, int $startX = null, int $startY = null)` | `self` | Clears a space of $width * $height in order to add a logo or text. | |
| 33 | +| `writeCodewords(BitBuffer $bitBuffer)` | `self` | Maps the interleaved binary data on the matrix | |
| 34 | +| `mask(MaskPattern $maskPattern)` | `self` | Applies/reverses the mask pattern | |
| 35 | + |
| 36 | +### Deprecated methods |
| 37 | + |
| 38 | +| method | since | replacement | |
| 39 | +|-----------------|---------|------------------------------| |
| 40 | +| `matrix()` | `5.0.0` | `QRMatrix::getMatrix()` | |
| 41 | +| `eccLevel()` | `5.0.0` | `QRMatrix::getEccLevel()` | |
| 42 | +| `version()` | `5.0.0` | `QRMatrix::getVersion()` | |
| 43 | +| `maskPattern()` | `5.0.0` | `QRMatrix::getMaskPattern()` | |
| 44 | +| `size()` | `5.0.0` | `QRMatrix::getSize()` | |
| 45 | + |
| 46 | +## Constants |
| 47 | + |
| 48 | +The `_DARK` prefixed constans exist purely for convenience - their value is the same as `QRMatrix::M_XXX\|QRMatrix::IS_DARK`, see [`QROutputInterface`](./API-QROutputInterface.md). |
| 49 | + |
| 50 | +| name | description | |
| 51 | +|--------------------|-----------------------------------------------------------------------------------| |
| 52 | +| `IS_DARK` | sets the "dark" flag for the given value: `QRMatrix::M_DATA \| QRMatrix::IS_DARK` | |
| 53 | +| `M_NULL` | module not set | |
| 54 | +| `M_DARKMODULE` | once per matrix at `$xy = [8, 4 * $version + 9]` | |
| 55 | +| `M_DATA` | the actual encoded data | |
| 56 | +| `M_DATA_DARK` | convenience | |
| 57 | +| `M_FINDER` | the 7x7 finder patterns | |
| 58 | +| `M_FINDER_DARK` | convenience | |
| 59 | +| `M_FINDER_DOT` | the inner 3x3 block of the finder pattern | |
| 60 | +| `M_SEPARATOR` | separator lines along the finder patterns | |
| 61 | +| `M_SEPARATOR_DARK` | convenience | |
| 62 | +| `M_ALIGNMENT` | the 5x5 alignment patterns | |
| 63 | +| `M_ALIGNMENT_DARK` | convenience | |
| 64 | +| `M_TIMING` | the timing pattern lines | |
| 65 | +| `M_TIMING_DARK` | convenience | |
| 66 | +| `M_FORMAT` | format information pattern | |
| 67 | +| `M_FORMAT_DARK` | convenience | |
| 68 | +| `M_VERSION` | version information pattern | |
| 69 | +| `M_VERSION_DARK` | convenience | |
| 70 | +| `M_QUIETZONE` | margin around the QR Code | |
| 71 | +| `M_QUIETZONE_DARK` | convenience | |
| 72 | +| `M_LOGO` | space for a logo image (not used yet) | |
| 73 | +| `M_LOGO_DARK` | convenience | |
| 74 | +| `M_TEST` | test value | |
| 75 | +| `M_TEST_DARK` | convenience | |
0 commit comments