GD 関数
PHP Manual

imagefilledpolygon

(PHP 4, PHP 5)

imagefilledpolygon塗りつぶした多角形を描画する

説明

bool imagefilledpolygon ( resource $image , array $points , int $num_points , int $color )

imagefilledpolygon() は画像 image 上に塗りつぶした多角形を生成します。

パラメータ

image

imagecreatetruecolor() のような画像作成関数が返す画像リソース。

points

多角形の頂点の座標 x および y を含む配列。

num_points

頂点の総数。 3 以上である必要があります。

color

imagecolorallocate() で作成した色 ID。

返り値

成功した場合に TRUE を、失敗した場合に FALSE を返します。

例1 imagefilledpolygon() の例

<?php
// 多角形の点の配列を準備します
$values = array(
            
40,  50,  // Point 1 (x, y)
            
20,  240// Point 2 (x, y)
            
60,  60,  // Point 3 (x, y)
            
24020,  // Point 4 (x, y)
            
50,  40,  // Point 5 (x, y)
            
10,  10   // Point 6 (x, y)
            
);

// 画像を生成します
$image imagecreatetruecolor(250250);

// いくつかの色
$bg   imagecolorallocate($image200200200);
$blue imagecolorallocate($image00255);

// 多角形を描画します
imagefilledpolygon($image$values6$blue);

// 画像を出力します
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?>

上の例の出力は、たとえば 以下のようになります。


GD 関数
PHP Manual
[お役立ちリンク集]

NPO法人の設立(東京・大阪) 東京や大阪などNPO法人を設立する場合の注意点等を紹介

不動産・賃貸・マンション 不動産・賃貸・マンションに関する用語集です。

堺市の入院・内科

大阪の賃貸探し 大阪で賃貸を探している方は大阪ホームへ

東京の賃貸マンション 東京で賃貸を探すなら東京賃貸.orgへ