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

imagearc

(PHP 4, PHP 5, PHP 7)

imagearc - 绘制一条弧线

描述

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

imagearc()绘制以给定坐标为中心的圆弧。

参数

代码语言:txt
复制
`image`   

一个图像资源,由图像创建函数之一返回,如imagecreatetruecolor()。

cx

中心的x坐标。

cy

中心的y坐标。

width

弧宽。

height

弧高。

start

弧起始角度,以度为单位。

end

弧度结束角度,以度为单位。0°位于三点钟位置,并且圆弧顺时针方向。

color

使用imagecolorallocate()创建的颜色标识符。

返回值

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

例子

示例#1用imagearc()绘制一个圆圈

代码语言:javascript
复制
<?php

//?create?a?200*200?image
$img?=?imagecreatetruecolor(200,?200);

//?allocate?some?colors
$white?=?imagecolorallocate($img,?255,?255,?255);
$red???=?imagecolorallocate($img,?255,???0,???0);
$green?=?imagecolorallocate($img,???0,?255,???0);
$blue??=?imagecolorallocate($img,???0,???0,?255);

//?draw?the?head
imagearc($img,?100,?100,?200,?200,??0,?360,?$white);
//?mouth
imagearc($img,?100,?100,?150,?150,?25,?155,?$red);
//?left?and?then?the?right?eye
imagearc($img,??60,??75,??50,??50,??0,?360,?$green);
imagearc($img,?140,??75,??50,??50,??0,?360,?$blue);

//?output?image?in?the?browser
header("Content-type:?image/png");
imagepng($img);

//?free?memory
imagedestroy($img);

?>

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

也可以看看

  • imagefilledarc() - Draw a partial arc and fill it
  • imageellipse() - Draw an ellipse
  • imagefilledellipse() - Draw a filled ellipse

← imageantialias

imagebmp →

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com