Fix background and foreground colors being sometimes inverted
This commit is contained in:
parent
cd3adddee8
commit
e45f1f0b67
1 changed files with 6 additions and 6 deletions
|
@ -1496,20 +1496,20 @@ class QrCode
|
|||
$allow_alpha = $imagecolorset_function->getNumberOfParameters() == 6;
|
||||
|
||||
if ($this->color_background != null) {
|
||||
$index = imagecolorclosest($output_image, 255, 255, 255);
|
||||
//$index = imagecolorclosest($output_image, 255, 255, 255);
|
||||
if ($allow_alpha) {
|
||||
imagecolorset($output_image, $index, $this->color_background['r'], $this->color_background['g'], $this->color_background['b'], $this->color_background['a']);
|
||||
imagecolorset($output_image, 0, $this->color_background['r'], $this->color_background['g'], $this->color_background['b'], $this->color_background['a']);
|
||||
} else {
|
||||
imagecolorset($output_image, $index, $this->color_background['r'], $this->color_background['g'], $this->color_background['b']);
|
||||
imagecolorset($output_image, 0, $this->color_background['r'], $this->color_background['g'], $this->color_background['b']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->color_foreground != null) {
|
||||
$index = imagecolorclosest($output_image, 0, 0, 0);
|
||||
//$index = imagecolorclosest($output_image, 0, 0, 0);
|
||||
if ($allow_alpha) {
|
||||
imagecolorset($output_image, $index, $this->color_foreground['r'], $this->color_foreground['g'], $this->color_foreground['b'], $this->color_foreground['a']);
|
||||
imagecolorset($output_image, 1, $this->color_foreground['r'], $this->color_foreground['g'], $this->color_foreground['b'], $this->color_foreground['a']);
|
||||
} else {
|
||||
imagecolorset($output_image, $index, $this->color_foreground['r'], $this->color_foreground['g'], $this->color_foreground['b']);
|
||||
imagecolorset($output_image, 1, $this->color_foreground['r'], $this->color_foreground['g'], $this->color_foreground['b']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue