QRInterventionImage
extends QROutputAbstract
in package
Uses
CssColorModuleValueTrait
intervention/image (GD/ImageMagick) output
note: this output class works very slow compared to the native GD/Imagick output classes for obvious reasons. use only if you must.
Tags
Table of Contents
Properties
- $circleDiameter : float
- $circleRadius : float
- $connectPaths : bool
- $drawCircularModules : bool
- $drawLightModules : bool
- $driver : DriverInterface
- $eol : string
- $excludeFromConnect : array<string|int, mixed>
- $image : ImageInterface
- $keepAsSquare : array<string|int, mixed>
- $length : int
- the side length of the QR image (modules * scale)
- $manager : ImageManagerInterface
- $matrix : QRMatrix
- the (filled) data matrix object
- $moduleCount : int
- the current size of the QR matrix
- $moduleValues : array<string|int, mixed>
- an (optional) array of color values for the several QR matrix parts
- $options : SettingsContainerInterface|QROptions
- the options instance
- $scale : int
Methods
- __construct() : mixed
- QRInterventionImage constructor.
- dump() : string|ImageInterface
- moduleValueIsValid() : bool
- note: we're not necessarily validating the several values, just checking the general syntax note: css4 colors are not included
- setDriver() : static
- Sets a DriverInterface
- collectModules() : array<string|int, mixed>
- collects the modules per QRMatrix::M_* type and runs a $transform function on each module and returns an array with the transformed modules
- copyVars() : void
- Creates copies of several QROptions values to avoid calling the magic getters in long loops for a significant performance increase.
- getDefaultModuleValue() : mixed
- Returns a default value for either dark or light modules (return value depends on the output class)
- getModuleValue() : mixed
- Returns the prepared value for the given $M_TYPE
- getModuleValueAt() : mixed
- Returns the prepared module value at the given coordinate [$x, $y] (convenience)
- getOutputDimensions() : array<string|int, mixed>
- Returns a 2 element array with the current output width and height
- module() : void
- draws a single pixel at the given position
- prepareModuleValue() : mixed
- Prepares the value for the given input (return value depends on the output class)
- saveToFile() : void
- Saves the qr $data to a $file. If $file is null, nothing happens.
- setMatrixDimensions() : void
- Sets/updates the matrix dimensions
- setModuleValues() : void
- Sets the initial module values
- toBase64DataURI() : string
- Returns a base64 data URI for the given string and mime type
Properties
$circleDiameter
protected
float
$circleDiameter
$circleRadius
protected
float
$circleRadius
Tags
$connectPaths
protected
bool
$connectPaths
Tags
$drawCircularModules
protected
bool
$drawCircularModules
Tags
$drawLightModules
protected
bool
$drawLightModules
Tags
$driver
protected
DriverInterface
$driver
$eol
protected
string
$eol
Tags
$excludeFromConnect
protected
array<string|int, mixed>
$excludeFromConnect
Tags
$image
protected
ImageInterface
$image
$keepAsSquare
protected
array<string|int, mixed>
$keepAsSquare
Tags
$length
the side length of the QR image (modules * scale)
protected
int
$length
$manager
protected
ImageManagerInterface
$manager
$matrix
the (filled) data matrix object
protected
QRMatrix
$matrix
$moduleCount
the current size of the QR matrix
protected
int
$moduleCount
Tags
$moduleValues
an (optional) array of color values for the several QR matrix parts
protected
array<string|int, mixed>
$moduleValues
$options
the options instance
protected
SettingsContainerInterface|QROptions
$options
$scale
protected
int
$scale
Tags
Methods
__construct()
QRInterventionImage constructor.
public
__construct(SettingsContainerInterface|QROptions $options, QRMatrix $matrix) : mixed
Parameters
Tags
dump()
public
dump([string $file = null ]) : string|ImageInterface
Parameters
- $file : string = null
Tags
Return values
string|ImageInterfacemoduleValueIsValid()
note: we're not necessarily validating the several values, just checking the general syntax note: css4 colors are not included
public
static moduleValueIsValid(mixed $value) : bool
Parameters
- $value : mixed
Tags
Return values
boolsetDriver()
Sets a DriverInterface
public
setDriver(DriverInterface $driver) : static
Parameters
- $driver : DriverInterface
Return values
staticcollectModules()
collects the modules per QRMatrix::M_* type and runs a $transform function on each module and returns an array with the transformed modules
protected
collectModules(Closure $transform) : array<string|int, mixed>
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
- $transform : Closure
Return values
array<string|int, mixed>copyVars()
Creates copies of several QROptions values to avoid calling the magic getters in long loops for a significant performance increase.
protected
copyVars() : void
These variables are usually used in the "module" methods and are called up to 31329 times (at version 40).
getDefaultModuleValue()
Returns a default value for either dark or light modules (return value depends on the output class)
protected
abstract getDefaultModuleValue(bool $isDark) : mixed
Parameters
- $isDark : bool
getModuleValue()
Returns the prepared value for the given $M_TYPE
protected
getModuleValue(int $M_TYPE) : mixed
Parameters
- $M_TYPE : int
Tags
getModuleValueAt()
Returns the prepared module value at the given coordinate [$x, $y] (convenience)
protected
getModuleValueAt(int $x, int $y) : mixed
Parameters
- $x : int
- $y : int
getOutputDimensions()
Returns a 2 element array with the current output width and height
protected
getOutputDimensions() : array<string|int, mixed>
The type and units of the values depend on the output class. The default value is the current module count * scale.
Return values
array<string|int, mixed>module()
draws a single pixel at the given position
protected
module(int $x, int $y, int $M_TYPE) : void
Parameters
- $x : int
- $y : int
- $M_TYPE : int
prepareModuleValue()
Prepares the value for the given input (return value depends on the output class)
protected
abstract prepareModuleValue(mixed $value) : mixed
Parameters
- $value : mixed
saveToFile()
Saves the qr $data to a $file. If $file is null, nothing happens.
protected
saveToFile(string $data[, string $file = null ]) : void
Parameters
- $data : string
- $file : string = null
Tags
setMatrixDimensions()
Sets/updates the matrix dimensions
protected
setMatrixDimensions() : void
Call this method if you modify the matrix from within your custom module in case the dimensions have been changed
setModuleValues()
Sets the initial module values
protected
setModuleValues() : void
toBase64DataURI()
Returns a base64 data URI for the given string and mime type
protected
toBase64DataURI(string $data[, string $mime = null ]) : string
Parameters
- $data : string
- $mime : string = null