<?php
bool imagefill ( GdImage $image, int $x, int $y, int $color )
where,
$image = The image identifier
$x = The x-coordinate of the start point
$y = The y-coordinate of the start point
$color = The fill color as returned by imagecolorallocate
?>
<?php
echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';
$file01 = 'png/PNG 067 01 imagefill.png';
$id_01 = imagecreatetruecolor(300, 80);
$color01 = imagecolorallocate($id_01, 0, 255, 0);
$xf01 = 20;
$yf01 = 20;
imagefill($id_01, $xf01, $yf01, $color01);
imagepng($id_01, $file01);
imagedestroy($id_01);
echo $file01; ?><br><br><img src="<?php echo $file01; ?>"
alt="<?php echo $file01; ?>" title="<?php echo $file01; ?>"><br>
<?php
echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';
$file02 = 'png/PNG 067 02 imagefill.png';
$id_02 = imagecreate(300, 80);
$red02 = mt_rand(0, 255);
$green02 = mt_rand(0, 255);
$blue02 = mt_rand(0, 255);
$color02 =
imagecolorallocate($id_02, $red02, $green02, $blue02);
$xf02 = 0;
$yf02 = 0;
imagefill($id_02, $xf02, $yf02, $color02);
imagepng($id_02, $file02);
imagedestroy($id_02);
echo $file02; ?><br><br> <img src="<?php echo $file02; ?>"
alt="<?php echo $file02; ?>" title="<?php echo $file02; ?>"><br>
<?php
echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';
$file03 = 'jpeg/JPEG 030 03 imagefill.jpg';
$q03 = 50;
$id_03 = imagecreate(200,200);
$clr_1_03 = imagecolorallocate($id_03, 255, 255, 0);
$clr_2_03 = imagecolorallocate($id_03, 0, 0, 250);
$clr_4_03 = imagecolorallocate($id_03, 2,2,55);
imagerectangle($id_03, 100, 100, 150, 150, $clr_4_03);
imagefill($id_03, 110, 110, $clr_2_03);
imagejpeg ($id_03, $file03 , $q03);
echo $file03 . '<br><br>'; ?> <img src="<?php echo $file03; ?>"
alt="<?php echo $file03; ?>" title="<?php echo $file03; ?>">
<?php
echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';
$file04 = 'png/PNG 067 04 imagefill.png';
$q04 = 5;
$f04 = PNG_ALL_FILTERS;
$id_04 = imagecreatetruecolor(200,200);
$clr_1_04 = imagecolorallocate($id_04, 255, 255, 0);
$clr_2_04 = imagecolorallocate($id_04, 0, 0, 250);
$clr_4_04 = imagecolorallocate($id_04, 2,2,55);
imagefill($id_04, 0, 0, $clr_1_04);
imagerectangle($id_04, 100, 100, 150, 150, $clr_4_04);
imagefill($id_04, 10, 10, $clr_2_04);
imagepng ($id_04, $file04, $q04, $f04 );
imagedestroy($id_04);
echo $file04; ?><br><br><img src="<?php echo $file04; ?>"
alt="<?php echo $file04; ?>" title="<?php echo $file04; ?>">
<?php
echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';
$base_img = "png/baseXx.png";
$dest_img = "png/PNG 067 05 imagefill.png";
$quality = 9;
$filter = 4;
// PNG_FILTER_PAETH
echo basename($base_img) . '<br><br>'; ?>
<img src="<?php echo $base_img; ?>"
alt="<?php echo $base_img; ?>"><br><br><br>
<?php
$id_polig = imagecreatefrompng( $base_img);
$colorln = imagecolorallocate($id_polig, 255, 0, 0);
$colorfl = imagecolorallocate($id_polig, 0, 255, 0);
imagefill($id_polig, 110, 162, $colorfl);
imagefill($id_polig, 162, 152, $colorfl);
imagefill($id_polig, 200, 170, $colorfl);
imagefill($id_polig, 223, 164, $colorfl);
imagepng($id_polig, $dest_img, $quality, $filter);
echo basename($dest_img) . '<br><br>Resulting Image'; ?>
<br><br><img src="<?php echo $dest_img; ?>"
alt="<?php echo $dest_img; ?>">