woocommerce-pos
/
vendor_prefixed
/
chillerlan
/
php-qrcode
/
src
/
Common
/
LuminanceSourceInterface.php
LuminanceSourceInterface.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.18, at vendor_prefixed/chillerlan/php-qrcode/src/Common/LuminanceSourceInterface.php
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Interface LuminanceSourceInterface |
| 5 | * |
| 6 | * @created 18.11.2021 |
| 7 | * @author smiley <smiley@chillerlan.net> |
| 8 | * @copyright 2021 smiley |
| 9 | * @license MIT |
| 10 | */ |
| 11 | namespace WCPOS\Vendor\chillerlan\QRCode\Common; |
| 12 | |
| 13 | /** |
| 14 | */ |
| 15 | interface LuminanceSourceInterface |
| 16 | { |
| 17 | /** |
| 18 | * Fetches luminance data for the underlying bitmap. Values should be fetched using: |
| 19 | * `int luminance = array[y * width + x] & 0xff` |
| 20 | * |
| 21 | * @return array A row-major 2D array of luminance values. Do not use result $length as it may be |
| 22 | * larger than $width * $height bytes on some platforms. Do not modify the contents |
| 23 | * of the result. |
| 24 | */ |
| 25 | public function getLuminances() : array; |
| 26 | /** |
| 27 | * @return int The width of the bitmap. |
| 28 | */ |
| 29 | public function getWidth() : int; |
| 30 | /** |
| 31 | * @return int The height of the bitmap. |
| 32 | */ |
| 33 | public function getHeight() : int; |
| 34 | /** |
| 35 | * Fetches one row of luminance data from the underlying platform's bitmap. Values range from |
| 36 | * 0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have |
| 37 | * to bitwise and with 0xff for each value. It is preferable for implementations of this method |
| 38 | * to only fetch this row rather than the whole image, since no 2D Readers may be installed and |
| 39 | * getLuminances() may never be called. |
| 40 | * |
| 41 | * @param int $y The row to fetch, which must be in [0,getHeight()) |
| 42 | * |
| 43 | * @return array An array containing the luminance data. |
| 44 | * @throws \chillerlan\QRCode\Decoder\QRCodeDecoderException |
| 45 | */ |
| 46 | public function getRow(int $y) : array; |
| 47 | /** |
| 48 | * Creates a LuminanceSource instance from the given file |
| 49 | */ |
| 50 | public static function fromFile(string $path) : self; |
| 51 | /** |
| 52 | * Creates a LuminanceSource instance from the given data blob |
| 53 | */ |
| 54 | public static function fromBlob(string $blob) : self; |
| 55 | } |
| 56 |