imagefilledpolygon

(PHP 4, PHP 5, PHP 7)

imagefilledpolygon锟斤拷一锟斤拷锟斤拷尾锟斤拷锟斤拷

说锟斤拷

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

imagefilledpolygon() 锟斤拷 image 图锟斤拷锟叫伙拷一锟斤拷锟斤拷锟斤拷说亩锟斤拷锟轿★拷

points 锟斤拷锟斤拷锟斤拷一锟斤拷锟斤拷顺锟斤拷锟斤拷锟斤拷卸锟斤拷锟轿革拷锟斤拷锟斤拷锟� x 锟斤拷 y 锟斤拷锟斤拷锟斤拷锟斤拷椤�

num_points 锟斤拷锟斤拷锟角讹拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 3锟斤拷

Example #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);
?>