imagefilledpolygonとは? わかりやすく解説

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 を返します。

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

// 画像を生成します
$image = imagecreatetruecolor(250, 250);

// いくつかの色
$bg  = imagecolorallocate($image, 200, 200, 200);
$blue = imagecolorallocate($image, 0, 0, 255);

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

// 画像を出力します
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?>
上の例の出力は、たとえば 以下のようになります。
imagefilledpolygon





固有名詞の分類

このページでは「PHP関数リファレンス」からimagefilledpolygonを検索した結果を表示しています。
Weblioに収録されているすべての辞書からimagefilledpolygonを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からimagefilledpolygon を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「imagefilledpolygon」の関連用語

imagefilledpolygonのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



imagefilledpolygonのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
PHP Documentation GroupPHP Documentation Group
Copyright © 1997 - 2025 by the PHP Documentation Group.

©2025 GRAS Group, Inc.RSS