函数名:imagefilledarc()
适用版本:PHP 4 >= 4.0.6, PHP 5, PHP 7
用法:imagefilledarc() 函数用于绘制一个填充的椭圆弧。
语法:bool imagefilledarc ( resource $image , int $cx , int $cy , int $width , int $height , int $start , int $end , int $color , int $style )
参数:
返回值:成功时返回 true,失败时返回 false。
示例:
$width = 200;
$height = 200;
$image = imagecreatetruecolor($width, $height);
$bgColor = imagecolorallocate($image, 255, 255, 255);
$arcColor = imagecolorallocate($image, 255, 0, 0);
imagefilledrectangle($image, 0, 0, $width, $height, $bgColor);
imagefilledarc($image, $width/2, $height/2, $width, $height, 0, 180, $arcColor, IMG_ARC_PIE);
header('Content-Type: image/png');
imagepng($image);
imagedestroy($image);
以上示例创建了一个200x200像素的画布,背景色为白色。然后使用红色填充,绘制了一个半圆形的椭圆弧,并将结果输出为PNG格式的图像。最后销毁图像资源。