/**
* Fill entire image with color.
*
* @param Image $image
* @param Color $color Color object
* @param int $x X-coordinate of start point
* @param int $y Y-coordinate of start point
*
* @return self
*/
public function fill(&$image, $color, $x = 0, $y = 0)
{
if ($image->isAnimated()) {
// Ignore animated GIF for now
return $this;
}
$target = $image->getCore()->getImagePixelColor($x, $y);
$image->getCore()->floodfillPaintImage($color->getHexString(), 1, $target, $x, $y, false);
return $this;
}