Pimcore\Image\Adapter\GD::setBackgroundColor PHP Метод

setBackgroundColor() публичный Метод

public setBackgroundColor ( $color ) : Adapter
$color
Результат Pimcore\Image\Adapter
    public function setBackgroundColor($color)
    {
        $this->preModify();
        list($r, $g, $b) = $this->colorhex2colorarray($color);
        // just imagefill() on the existing image doesn't work, so we have to create a new image, fill it and then merge
        // the source image with the background-image together
        $newImg = imagecreatetruecolor($this->getWidth(), $this->getHeight());
        $color = imagecolorallocate($newImg, $r, $g, $b);
        imagefill($newImg, 0, 0, $color);
        imagecopy($newImg, $this->resource, 0, 0, 0, 0, $this->getWidth(), $this->getHeight());
        $this->resource = $newImg;
        $this->postModify();
        $this->setIsAlphaPossible(false);
        return $this;
    }