GDLuminanceSource
extends LuminanceSourceAbstract
in package
This class is used to help decode images from files which arrive as GD Resource It does not support rotation.
Table of Contents
Properties
- $height : int
- The height of the bitmap.
- $luminances : array<string|int, int>
- Fetches luminance data for the underlying bitmap. Values should be fetched using: `int luminance = array[y * width + x] & 0xff`
- $width : int
- The width of the bitmap.
- $options : SettingsContainerInterface|QROptions
- $gdImage : GdImage
Methods
- __construct() : mixed
- GDLuminanceSource constructor.
- fromBlob() : static
- Creates a LuminanceSource instance from the given data blob
- fromFile() : static
- Creates a LuminanceSource instance from the given file
- getRow() : array<string|int, int>
- Fetches one row of luminance data from the underlying platform's bitmap. Values range from 0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have to bitwise and with 0xff for each value. It is preferable for implementations of this method to only fetch this row rather than the whole image, since no 2D Readers may be installed and getLuminances() may never be called.
- checkFile() : string
- setLuminancePixel() : void
- setLuminancePixels() : void
Properties
$height
The height of the bitmap.
public protected(set)
int
$height
$luminances
Fetches luminance data for the underlying bitmap. Values should be fetched using: `int luminance = array[y * width + x] & 0xff`
public protected(set)
array<string|int, int>
$luminances
= []
A row-major 2D array of luminance values. Do not use result $length as it may be larger than $width * $height bytes on some platforms. Do not modify the contents of the result.
$width
The width of the bitmap.
public protected(set)
int
$width
$options
protected
SettingsContainerInterface|QROptions
$options
$gdImage
private
GdImage
$gdImage
Methods
__construct()
GDLuminanceSource constructor.
public
__construct(GdImage $gdImage[, SettingsContainerInterface|QROptions $options = new QROptions() ]) : mixed
Parameters
Tags
fromBlob()
Creates a LuminanceSource instance from the given data blob
public
static fromBlob(string $blob[, SettingsContainerInterface|QROptions $options = new QROptions() ]) : static
Parameters
Return values
staticfromFile()
Creates a LuminanceSource instance from the given file
public
static fromFile(string $path[, SettingsContainerInterface|QROptions $options = new QROptions() ]) : static
Parameters
Return values
staticgetRow()
Fetches one row of luminance data from the underlying platform's bitmap. Values range from 0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have to bitwise and with 0xff for each value. It is preferable for implementations of this method to only fetch this row rather than the whole image, since no 2D Readers may be installed and getLuminances() may never be called.
public
getRow(int $y) : array<string|int, int>
Parameters
- $y : int
-
The row to fetch, which must be in [0,getHeight())
Return values
array<string|int, int> —An array containing the luminance data.
checkFile()
protected
static checkFile(string $path) : string
Parameters
- $path : string
Tags
Return values
stringsetLuminancePixel()
protected
setLuminancePixel(int $r, int $g, int $b) : void
Parameters
- $r : int
- $g : int
- $b : int
setLuminancePixels()
private
setLuminancePixels() : void