PHP imagearc - Draw Elliptical Arc

PHP 图像处理PHP Image Processing

imagearc — Used to draw an elliptical arc.

Syntax

bool imagearc ( resource $image , int $cx , int $cy , int $w , int $h , int $s , int $e , int $color )

imagearc() draws an elliptical arc in the image represented by image, centered at cx, cy (the top-left corner of the image is 0, 0).

w and h specify the width and height of the ellipse respectively. The start and end points are specified in degrees by the s and e parameters. 0° is at the three o'clock position, and the arc is drawn clockwise.

Example

<?php
$img = imagecreatetruecolor(200, 200);// 创建一个 200*200 图片
$white  = imagecolorallocate($img,   255,   255, 255); // 颜色

// 画椭圆弧
imagearc($img, 140,  75,  50,  50,  0, 360, $white);

// 浏览器输出图片
header("Content-type: image/png");
imagepng($img);

imagedestroy($img);
?>

The image output by the above example is as follows:

PHP 图像处理PHP Image Processing

Other Extensions