(PHP 4, PHP 5, PHP 7, PHP 8)
imagefill — 漫水填充
使用 image 中的指定 color 从指定坐标(左上角为 0,0)开始执行漫水填充。
image由图象创建函数(例如imagecreatetruecolor())返回的 GdImage 对象。
x起点的 x 坐标。
y起点的 y 坐标。
color填充颜色。颜色标识符使用 imagecolorallocate() 创建。
成功时返回 true, 或者在失败时返回 false。
| 版本 | 说明 |
|---|---|
| 8.0.0 |
image 现在需要 GdImage 实例;之前需要有效的 gd resource。
|
示例 #1 imagefill() 示例
<?php
$im = imagecreatetruecolor(100, 100);
// 设置背景为红色
$red = imagecolorallocate($im, 255, 0, 0);
imagefill($im, 0, 0, $red);
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
以上例程的输出类似于: