close

 

說明
bool imagefilledarc ( resource $image , int $cx , int $cy , int $width , int $height , int $start , int $end , int $color , int $style )


參數

image
由圖象創建函數(例如imagecreatetruecolor())返回的圖象資源。

cx
中間的 x 坐標。

cy
中間的 y 坐標。

width
橢圓弧的寬度。

height
橢圓弧的高度。

start
起點角度。

end
終點角度。 0° is located at the three-o'clock position, and the arc is drawn clockwise.

color
imagecolorallocate() 創建的顏色標識符。

style
值可以是下列值的按位或(OR):

IMG_ARC_PIE
IMG_ARC_CHORD
IMG_ARC_NOFILL
IMG_ARC_EDGED
IMG_ARC_PIE 和 IMG_ARC_CHORD 是互斥的;IMG_ARC_CHORD 只是用直線連接了起始和結束點,
IMG_ARC_PIE 則產生圓形邊界。IMG_ARC_NOFILL 指明弧或弦只有輪廓,不填充。
IMG_ARC_EDGED 指明用直線將起始和結束點與中心點相連,和
IMG_ARC_NOFILL 一起使用是畫餅狀圖輪廓的好方法(而不用填充)。


創建一 3D 效果的餅狀圖

<?php

// 創建圖像
$image = imagecreatetruecolor(100, 100);

// 分配一些顏色
$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
$gray = imagecolorallocate($image, 0xC0, 0xC0, 0xC0);
$darkgray = imagecolorallocate($image, 0x90, 0x90, 0x90);
$navy = imagecolorallocate($image, 0x00, 0x00, 0x80);
$darknavy = imagecolorallocate($image, 0x00, 0x00, 0x50);
$red = imagecolorallocate($image, 0xFF, 0x00, 0x00);
$darkred = imagecolorallocate($image, 0x90, 0x00, 0x00);

// 創建 3D 效果
for ($i = 60; $i > 50; $i--) {
imagefilledarc($image, 50, $i, 100, 50, 0, 45, $darknavy, IMG_ARC_PIE);
imagefilledarc($image, 50, $i, 100, 50, 45, 75 , $darkgray, IMG_ARC_PIE);
imagefilledarc($image, 50, $i, 100, 50, 75, 360 , $darkred, IMG_ARC_PIE);
}

imagefilledarc($image, 50, 50, 100, 50, 0, 45, $navy, IMG_ARC_PIE);
imagefilledarc($image, 50, 50, 100, 50, 45, 75 , $gray, IMG_ARC_PIE);
imagefilledarc($image, 50, 50, 100, 50, 75, 360 , $red, IMG_ARC_PIE);


// 輸出圖像
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?>

arrow
arrow
    全站熱搜

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