首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

imagefilledarc

(PHP 4 >= 4.0.6, PHP 5, PHP 7)

imagefilledarc - 绘制一个部分弧并填充它

描述

代码语言:javascript
复制
bool imagefilledarc ( resource $image , int $cx , int $cy , int $width , int $height , int $start , int $end , int $color , int $style )

绘制以给定坐标中心为中心的部分圆弧image

参数

代码语言:txt
复制
`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

IMG_ARC_PIEIMG_ARC_CHORD相互排斥; IMG_ARC_CHORD只是将起始角和终止角用直线连接起来,同时IMG_ARC_PIE产生圆角边缘。IMG_ARC_NOFILL表示弧线或和弦应勾勒出来,而不是填充。IMG_ARC_EDGED与“一起使用IMG_ARC_NOFILL”表示起始角度和结束角度应该连接到中心 - 这是勾画(而不是填充)“饼图切片”的好方法。

返回值

返回TRUE成功或失败时返回FALSE

例子

Example #1 Creating a 3D looking pie

代码语言:javascript
复制
<?php

//?create?image
$image?=?imagecreatetruecolor(100,?100);

//?allocate?some?colors
$white????=?imagecolorallocate($image,?0xFF,?0xFF,?0xFF);
$gray?????=?imagecolorallocate($image,?0xC0,?0xC0,?0xC0);
$darkgray?=?imagecolorallocate($image,?0x90,?0x90,?0x90);
$navy?????=?imagecolorallocate($image,?0x00,?0x00,?0x80);
$darknavy?=?imagecolorallocate($image,?0x00,?0x00,?0x50);
$red??????=?imagecolorallocate($image,?0xFF,?0x00,?0x00);
$darkred??=?imagecolorallocate($image,?0x90,?0x00,?0x00);

//?make?the?3D?effect
for?($i?=?60;?$i?>?50;?$i--)?{
???imagefilledarc($image,?50,?$i,?100,?50,?0,?45,?$darknavy,?IMG_ARC_PIE);
???imagefilledarc($image,?50,?$i,?100,?50,?45,?75?,?$darkgray,?IMG_ARC_PIE);
???imagefilledarc($image,?50,?$i,?100,?50,?75,?360?,?$darkred,?IMG_ARC_PIE);
}

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

上面的例子会输出类似于:

← imagefill

imagefilledellipse →

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com