imagearc() 函数用于绘制椭圆弧(包括圆弧)。
语法:
bool imagearc(resource image, int cx, int cy, int w, int h, int s, int e, int color )
| 参数 | 说明 |
|---|---|
| image | 图像资源,欲绘制椭圆弧的图像 |
| cx | 椭圆中心 x 坐标 |
| cy | 椭圆中心 y 坐标 |
| w | 椭圆宽度 |
| h | 椭圆高度 |
| s | 起始点,0 表示 3 点钟方向 |
| e | 角度,360 表示完全封闭 |
| color | 图像颜色 |
例子:
<?php
header("Content-type: image/png");
$im = @imagecreate(200, 200)or die("创建图像资源失败");
$bg = imagecolorallocate($im, 204, 204, 204);
$red = imagecolorallocate($im, 255, 0, 0);
imagearc($im, 100, 100, 150, 150, 0, 360, $red);
imagepng($im);
imagedestroy($im);
?>
该例子绘制一个圆圈,