= 4.0.6, PHP 5, PHP 7, PHP 8)imagefilledarc — 畫一橢圓弧且填充說明imagefilledarc( resource $image, int $cx, int $cy, int $widt">

imagefilledarc

(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)

imagefilledarc畫一橢圓弧且填充

說明

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

在指定的 image 上畫一橢圓弧且填充。

參數(shù)

image

由圖象創(chuàng)建函數(shù)(例如imagecreatetruecolor())返回的 GdImage 對象。

cx

中間的 x 坐標(biāo)。

cy

中間的 y 坐標(biāo)。

width

橢圓弧的寬度。

height

橢圓弧的高度。

start

起點角度。

end

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

color

imagecolorallocate() 創(chuàng)建的顏色標(biāo)識符。

style

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

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

返回值

成功時返回 true, 或者在失敗時返回 false。

范例

示例 #1 創(chuàng)建一 3D 效果的餅狀圖

<?php

// 創(chuàng)建圖像
$image imagecreatetruecolor(100100);

// 分配一些顏色
$white    imagecolorallocate($image0xFF0xFF0xFF);
$gray     imagecolorallocate($image0xC00xC00xC0);
$darkgray imagecolorallocate($image0x900x900x90);
$navy     imagecolorallocate($image0x000x000x80);
$darknavy imagecolorallocate($image0x000x000x50);
$red      imagecolorallocate($image0xFF0x000x00);
$darkred  imagecolorallocate($image0x900x000x00);

// 創(chuàng)建 3D 效果
for ($i 60$i 50$i--) {
   
imagefilledarc($image50$i10050045$darknavyIMG_ARC_PIE);
   
imagefilledarc($image50$i100504575 $darkgrayIMG_ARC_PIE);
   
imagefilledarc($image50$i1005075360 $darkredIMG_ARC_PIE);
}

imagefilledarc($image505010050045$navyIMG_ARC_PIE);
imagefilledarc($image5050100504575 $grayIMG_ARC_PIE);
imagefilledarc($image50501005075360 $redIMG_ARC_PIE);


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

以上例程的輸出類似于:

例子輸出:創(chuàng)建一 3D 效果的餅狀圖

注釋