imagefilledpolygon
    (PHP 3, PHP 4, PHP 5)
imagefilledpolygon -- 塗りつぶした多角形の描画
説明
bool 
imagefilledpolygon ( resource image, array points, int num_points, int color )
     imagefilledpolygon() は画像
     image 上に塗りつぶした多角形を生成します。
    
     points は PHP の配列で、多角形の頂点、すなわち
     points[0] = x0, points[1] = y0, points[2] = x1,
     points[3] = y1 などという具合になっています。
    
     num_points は頂点の総数で、
     3 以上である必要があります。
    
     
| 例 1. 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);
 ?>
 | 
 |