Two types of Flood Filling
<?php

    define
("WIDTH"450);
    
define("HEIGHT"450);
    
    
$img imagecreate(WIDTHHEIGHT);
    
$background $white imagecolorallocate($img0xFF0xFF0xFF);
    
$black imagecolorallocate($img000);
    
$red imagecolorallocate($img0xFF00);
    
$blue imagecolorallocate($img000xFF);
    
    
$center_x = (int)WIDTH/2;
    
$center_y = (int)HEIGHT/2;
    
    
imagerectangle($img00WIDTH-1HEIGHT-1$black);
    
    
imageline($img$center_x0$center_xHEIGHT-1$black);
    
imageline($img00WIDTH-1HEIGHT-1$red);
    
imageline($imgWIDTH-100HEIGHT-1$blue);
    
    
imagefill($img220$black);
    
imagefilltoborder($imgWIDTH-220$red$blue);

    
header("Content-Type: image/png");    
    
imagepng($img);
?>