加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

php imagefilledarc()函数

发布时间:2020-05-30 19:21:28 所属栏目:PHP 来源:互联网
导读:php imagefilledarc()函数绘制一个局部弧并填充它。 本文章向大家介绍php imagefilledarc()函数的基本使用方法和实例,需要的朋友可以参考一下。

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。

实例

/*

http://www.manongjc.com/article/1754.html

作者:脚本之家教程

*/

// create image

$image = imagecreatetruecolor(100,100);

// allocate some colors

$gray = imagecolorallocate($image,0xC0,0xC0);

$navy = imagecolorallocate($image,0x00,0x80);

$red = imagecolorallocate($image,0xFF,0x00);

imagefilledarc($image,50,100,45,$navy,IMG_ARC_PIE);

imagefilledarc($image,75,$gray,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:

/*

http://www.manongjc.com/article/1754.html

作者:脚本之家教程

*/

$myImage = imagecreate( 500,500 );

$myGray = imagecolorallocate( $myImage,204,204 );

$myBlack = imagecolorallocate( $myImage,0 );

imagefilledarc($image,200,150,345,15,$green,IMG_ARC_CHORD | IMG_ARC_NOFILL);

header( "Content-type: image/png" );

imagepng( $myImage );

imagedestroy( $myImage );

?>

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读