|
imagefilledarc (PHP 4 >= 4.0.6, PHP 5) imagefilledarc -- 畫一橢圓弧且填充 說明bool imagefilledarc ( resource image, int cx, int cy, int w, int h, int s, int e, int color, int style )
imagefilledarc() 在 image
所代表的圖像中以
cx,cy(圖像左上角為
0, 0)畫一橢圓弧。若果成功則返回 TRUE,失敗則返回 FALSE。w 和 h
分別指定了橢圓的寬和高,s 和
e 參數以角度指定了起始和結束點。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_CHORD
生效)。 IMG_ARC_NOFILL
指明弧或弦只有輪廓,不填充。 IMG_ARC_EDGED
指明用直線將起始和結束點與中心點相連,和 IMG_ARC_NOFILL
一起使用是畫餅狀圖輪廓的好方法(而不用填充)。
例子 1. 建立一 3D 效果的餅狀圖
<?php // create image $image = imagecreatetruecolor(100, 100);
// allocate some solors $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);
// make the 3D effect 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);
// flush image header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?>
|
|
| |