array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'function.imagefilledrectangle.php', 1 => 'imagefilledrectangle', ), 'up' => array ( 0 => 'ref.image.php', 1 => 'GD および Image 関数', ), 'prev' => array ( 0 => 'function.imagefilledpolygon.php', 1 => 'imagefilledpolygon', ), 'next' => array ( 0 => 'function.imagefilltoborder.php', 1 => 'imagefilltoborder', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/image/functions/imagefilledrectangle.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
imagefilledrectangle — 塗りつぶした矩形を描画する
色 color
で塗りつぶした矩形を、
指定した image
上に作成します。
開始位置と終了位置を指定します。0, 0
が画像の左上角を表します。
image
imagecreatetruecolor()のような画像作成関数が返す GdImage オブジェクト。
x1
開始位置の x 座標。
y1
開始位置の y 座標。
x2
終了位置の x 座標。
y2
終了位置の y 座標。
color
塗りつぶし色。imagecolorallocate() で作成された色識別子。
バージョン | 説明 |
---|---|
8.0.0 |
image は、
GdImage
クラスのインスタンスを期待するようになりました。
これより前のバージョンでは、有効な gd resource が期待されていました。
|
例1 imagefilledrectangle() の例
<?php
// 55x30 の画像を作成します
$im = imagecreatetruecolor(55, 30);
$white = imagecolorallocate($im, 255, 255, 255);
// 白の矩形を描画します
imagefilledrectangle($im, 4, 4, 50, 25, $white);
// 画像を保存します
imagepng($im, './imagefilledrectangle.png');
imagedestroy($im);
?>
上の例の出力は、 たとえば以下のようになります。