牛牛在线工具

imagefilledarc()

收录 8868 个 PHP 函数,含用途说明与用法示例。

imagefilledarc()

绘制一个填充的椭圆弧

函数名: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 ) 参数: $image:图像资源,使用 imagecreatetruecolor() 创建。 $cx:椭圆弧中心点的 x 坐标。 $cy:椭圆弧中心点的 y 坐标。 $width:椭圆弧的宽度。 $height:椭圆弧的高度。 $start:椭圆弧的起始角度,以度数表示(顺时针方向,0度为3点钟方向)。 $end:椭圆弧的结束角度,以度数表示(顺时针方向,0度为3点钟方向)。 $color:填充颜色,可以使用 imagecolorallocate() 函数创建。 $style:填充样式,可以是下面的常量之一: IMG_ARC_PIE:填充整个椭圆弧,包括起始和结束角度之间的区域。 IMG_ARC_CHORD:填充椭圆弧的弦,不包括起始和结束角度之间的区域。 IMG_ARC_NOFILL:只绘制椭圆弧的轮廓。 返回值:成功时返回 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格式的图像。最后销毁图像资源。