php imagefill(),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, 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:

/*

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 );

?>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值