JBZoo\Image\Filter::fill PHP Method

fill() public static method

Fill image with color
public static fill ( mixed $image, string $color = '#000000' )
$image mixed GD resource
$color string Hex color string, array(red, green, blue) or array(red, green, blue, alpha). Where red, green, blue - integers 0-255, alpha - integer 0-127
    public static function fill($image, $color = '#000000')
    {
        $width = imagesx($image);
        $height = imagesy($image);
        $rgba = Helper::normalizeColor($color);
        $fillColor = imagecolorallocatealpha($image, $rgba[0], $rgba[1], $rgba[2], $rgba[3]);
        Helper::addAlpha($image, false);
        imagefilledrectangle($image, 0, 0, $width, $height, $fillColor);
    }