imagefill
(PHP 4, PHP 5, PHP 7, PHP 8)
imagefill — 漫水填充
说明
使用 image 中的指定 color 从指定坐标(左上角为 0,0)开始执行漫水填充。
参数
image由图象创建函数(例如imagecreatetruecolor())返回的 GdImage 对象。
x
起点的 x 坐标。
y
起点的 y 坐标。
color
填充颜色。颜色标识符使用 imagecolorallocate() 创建。
返回值
总是返回 true。
示例
示例 #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);
?>以上示例的输出类似于:
参见
- imagecolorallocate() - 为图像分配颜色
来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。
