:octocat: make $background local

This commit is contained in:
codemasher
2019-06-22 14:49:16 +02:00
parent 4db5a40c23
commit ea852127f6
+5 -11
View File
@@ -29,7 +29,7 @@ class QRImage extends QROutputAbstract{
/**
* @var string
*/
protected $defaultMode = QRCode::OUTPUT_IMAGE_PNG;
protected $defaultMode = QRCode::OUTPUT_IMAGE_PNG;
/**
* @see imagecreatetruecolor()
@@ -37,12 +37,6 @@ class QRImage extends QROutputAbstract{
*/
protected $image;
/**
* @see imagecolorallocate()
* @var int
*/
protected $background;
/**
* @return void
*/
@@ -70,14 +64,14 @@ class QRImage extends QROutputAbstract{
* @return string
*/
public function dump(string $file = null):string{
$this->image = \imagecreatetruecolor($this->length, $this->length);
$this->background = \imagecolorallocate($this->image, ...$this->options->imageTransparencyBG);
$this->image = \imagecreatetruecolor($this->length, $this->length);
$background = \imagecolorallocate($this->image, ...$this->options->imageTransparencyBG);
if((bool)$this->options->imageTransparent && \in_array($this->options->outputType, $this::TRANSPARENCY_TYPES, true)){
\imagecolortransparent($this->image, $this->background);
\imagecolortransparent($this->image, $background);
}
\imagefilledrectangle($this->image, 0, 0, $this->length, $this->length, $this->background);
\imagefilledrectangle($this->image, 0, 0, $this->length, $this->length, $background);
foreach($this->matrix->matrix() as $y => $row){
foreach($row as $x => $M_TYPE){