Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Flood fill
<?php imagefill(    GdImage $image,    int $x,    int $y,    int $color): bool
<?php             imagecopy($base, $resource, 0, 0, 0, 0, $width, $height);




            imagefill($resource, $x, $y, $filling);




            imagecopy($base, $resource, 0, 0, 0, 0, $width, $height);
<?php         }




        imagefill($resource, 0, 0, $matte);




        imagecolortransparent($resource, $matte);
<?php         if ($transIndex != -1) {

            $rgba = imagecolorsforindex($modified, $transIndex);

            $transColor = imagecolorallocatealpha($modified, $rgba['red'], $rgba['green'], $rgba['blue'], 127);

            imagefill($modified, 0, 0, $transColor);

            imagecolortransparent($modified, $transColor);

        } else {

            imagealphablending($modified, false);
<?php         $background = new Color($background);

        imagefill($image->getCore(), 0, 0, $background->getInt());



        return $image;

    }
<?php         imagealphablending($clone, false);

        imagesavealpha($clone, true);

        $transparency = imagecolorallocatealpha($clone, 0, 0, 0, 127);

        imagefill($clone, 0, 0, $transparency);

        

        imagecopy($clone, $core, 0, 0, 0, 0, $width, $height);