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

 

语法

PHP imagearc()函数具有以下语法。

bool imagearc(resource $image , int $cx , int $cy , int $width , int $height , int $start , int $end , int $color )

 

参数

PHP imagearc()函数具有以下参数。

  • image - 由图像创建函数(如imagecreatetruecolor())返回的图像资源。
  • cx - 中心的x坐标。
  • 中心的cy-y坐标。
  • width - 弧宽。
  • height - 圆弧高度。
  • start - 圆弧起始角,以度为单位。
  • end - 弧度结束角度,以度为单位。0?位于三点钟位置,并且弧顺时针绘制。
  • color - 使用imagecolorallocate()创建的颜色标识符。

 

返回值

成功时返回TRUE,失败时返回FALSE。

 

实例

使用imagearc()函数画圆弧。

<?php
/*
http://www.manongjc.com/article/1750.html
作者:码农教程
*/
$img = imagecreatetruecolor(200, 200);// create a 200*200 image
$blue  = imagecolorallocate($img,   0,   0, 255);// colors

// draw the head
imagearc($img, 140,  75,  50,  50,  0, 360, $blue);

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

imagedestroy($img);
?>
收藏 打印