php imagefilledarc()函数绘制一个局部弧并填充它。
语法
PHP imagefilledarc()函数具有以下语法。
bool imagefilledarc ( resource $image , int $cx , int $cy , int $width , int $height , int $start , int $end , int $color , int $style )
参数
PHP imagefilledarc()函数具有以下参数。
- image - 由图像创建函数(如imagecreatetruecolor())返回的图像资源。
- cx - 中心的x坐标。
- cy - 中心的y坐标。
- width - 弧宽。
- height - 圆弧高度。
- start - 圆弧起始角,以度为单位。
- end - 弧度结束角度,以度为单位。0?位于三点钟位置,并且弧顺时针绘制。
- color - 使用imagecolorallocate()创建的颜色标识符。
- style - 以下可能性的按位或:
样式的可能值:
| 值 | 含义 |
|---|---|
| IMG_ARC_PIE | 绘制具有弯曲边缘的填充楔形 |
| IMG_ARC_CHORD | 在起始角和结束角之间画一条直线 |
| IMG_ARC_NOFILL | 绘制外边缘线而不将两条线朝向弧的中心绘制 |
| IMG_ARC_EDGED | 绘制具有弯曲边缘的未填充楔形 |
返回值
成功时返回TRUE,失败时返回FALSE。
实例
<?php
/*
http://www.manongjc.com/article/1754.html
作者:码农教程
*/
// create image
$image = imagecreatetruecolor(100, 100);
// allocate some colors
$gray = imagecolorallocate($image, 0xC0, 0xC0, 0xC0);
$navy = imagecolorallocate($image, 0x00, 0x00, 0x80);
$red = imagecolorallocate($image, 0xFF, 0x00, 0x00);
imagefilledarc($image, 50, 50, 100, 50, 0, 45, $navy, IMG_ARC_PIE);
imagefilledarc($image, 50, 50, 100, 50, 45, 75 , $gray, IMG_ARC_PIE);
imagefilledarc($image, 50, 50, 100, 50, 75, 360 , $red, IMG_ARC_PIE);
// flush image
header(\'Content-type: image/png\');
imagepng($image);
imagedestroy($image);
?>
实例2
您可以将这四种风格组合在一起。
IMG_ARC_CHORD和IMG_ARC_PIE不能组合在一起。
imagefilledarc($image,200,150,200,200,345,15,$green,IMG_ARC_CHORD | IMG_ARC_NOFILL);
imagefilledarc($image,200,150,200,200,345,15,$green,IMG_ARC_EDGED | IMG_ARC_NOFILL);
Example:
<?php
/*
http://www.manongjc.com/article/1754.html
作者:码农教程
*/
$myImage = imagecreate( 500, 500 );
$myGray = imagecolorallocate( $myImage, 204, 204, 204 );
$myBlack = imagecolorallocate( $myImage, 0, 0, 0 );
imagefilledarc($image, 200, 150, 200, 200, 345, 15, $green,IMG_ARC_CHORD | IMG_ARC_NOFILL);
header( \"Content-type: image/png\" );
imagepng( $myImage );
imagedestroy( $myImage );
?> 继续阅读与本文标签相同的文章
上一篇 :
php imageellipse()函数
-
欧司朗推出新款LiDAR激光器,为自动驾驶增添“千里眼”
2026-05-15栏目: 教程
-
单频光纤激光器技术及应用前景
2026-05-15栏目: 教程
-
想做出好看的Excel图表,可不能少了这些Excel图表网站
2026-05-15栏目: 教程
-
“沈鼓云”荣获2019中国智能制造十大实践案例
2026-05-15栏目: 教程
-
丰田LQ小型人工智能汽车东京车展亮相
2026-05-15栏目: 教程
