close

 


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

 

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

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 stockwfj3 的頭像
    stockwfj3

    程式設計@筆記

    stockwfj3 發表在 痞客邦 留言(0) 人氣()