array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'function.imagefill.php', 1 => 'imagefill', ), 'up' => array ( 0 => 'ref.image.php', 1 => 'GD および Image 関数', ), 'prev' => array ( 0 => 'function.imageellipse.php', 1 => 'imageellipse', ), 'next' => array ( 0 => 'function.imagefilledarc.php', 1 => 'imagefilledarc', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/image/functions/imagefill.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
imagefill — 塗り潰す
指定した座標 (左上が 0, 0 です) から、指定した色
color
で
image
を塗りつぶします。
image
imagecreatetruecolor()のような画像作成関数が返す GdImage オブジェクト。
x
開始位置の x 座標。
y
開始位置の y 座標。
color
塗りつぶし色。imagecolorallocate() で作成された色識別子。
バージョン | 説明 |
---|---|
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);
?>
上の例の出力は、 たとえば以下のようになります。