-
-
Notifications
You must be signed in to change notification settings - Fork 308
/
Copy pathQRCodeReaderOptionsTrait.php
55 lines (46 loc) · 1.24 KB
/
QRCodeReaderOptionsTrait.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
* QRCodeReaderOptionsTrait.php
*
* @created 01.03.2024
* @author smiley <[email protected]>
* @copyright 2024 smiley
* @license MIT
*/
declare(strict_types=1);
namespace chillerlan\QRCode;
use function extension_loaded;
/**
* Trait QRCodeReaderOptionsTrait
*
* @property bool $readerUseImagickIfAvailable
* @property bool $readerGrayscale
* @property bool $readerInvertColors
* @property bool $readerIncreaseContrast
*/
trait QRCodeReaderOptionsTrait{
/**
* Use Imagick (if available) when reading QR Codes
*/
protected bool $readerUseImagickIfAvailable = false;
/**
* Grayscale the image before reading
*/
protected bool $readerGrayscale = false;
/**
* Invert the colors of the image
*/
protected bool $readerInvertColors = false;
/**
* Increase the contrast before reading
*
* note that applying contrast works different in GD and Imagick, so mileage may vary
*/
protected bool $readerIncreaseContrast = false;
/**
* enables Imagick for the QR Code reader if the extension is available
*/
protected function set_readerUseImagickIfAvailable(bool $useImagickIfAvailable):void{
$this->readerUseImagickIfAvailable = ($useImagickIfAvailable && extension_loaded('imagick'));
}
}