画圆弧和饼状图
画圆弧并填充
所用函数:
imagearc — 画椭圆弧
- bool imagearc ( resource $image , int $cx , int $cy , int
$w , int $h , int $s , int $e , int $color )
参数:画布资源,圆心x值,圆心y值,宽,高,起始角度,结束角度,颜色
imagearc() 以 cx,cy(图像左上角为 0, 0)为中心在 image 所代表的图像中画一个椭圆弧。w 和 h 分别指定了椭圆的宽度和高度,起始和结束点以 s 和 e 参数以角度指定。0°位于三点钟位置,以顺时针方向绘画。
imagefilledarc — 画一椭圆弧且填充
- bool imagefilledarc ( resource $image , int $cx , int $cy , int
$width , int $height , int $start , int $end , int $color , int
$style )
在指定的 image 上画一椭圆弧且填充。
参数:画布资源,圆心x值,圆心y值,宽,高,起始角度,结束角度,颜色,填充方式
1 IMG_ARC_CHORD 直线连圆弧两端
0 IMG_ARC_PIE 弧线连圆弧两端
2 IMG_ARC_EDGED 用直线将起始点和结束点与中心点相连
4 IMG_ARC_NOFILL 不填充轮廓,默认是填充的
//画布
$im = imagecreatetruecolor(800,600);
//颜料
$gray = imagecolorallocate($im,200,200,200);
$blue = imagecolorallocate($im,0

本文介绍了如何使用PHP的imagearc和imagefilledarc函数来绘制圆弧和填充饼状图。详细解释了函数参数及其作用,并展示了不同填充方式的效果。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



