Easy Tutorial
❮ Func Math Atan Php Is_Float Function ❯

PHP imagearc - Drawing Elliptical Arcs

PHP Image Processing

imagearc — Used to draw elliptical arcs.

Syntax

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

imagearc() draws an elliptical arc centered at cx, cy (with the top-left corner of the image being 0, 0) on the image represented by $image.

w and h specify the width and height of the ellipse, respectively, with the start and end points specified by the s and e parameters in degrees. 0° is at the three o'clock position, and the drawing is done in a clockwise direction.

Example

<?php
$img = imagecreatetruecolor(200, 200); // Create a 200x200 image
$white = imagecolorallocate($img, 255, 255, 255); // Color

// Draw an elliptical arc
imagearc($img, 140, 75, 50, 50, 0, 360, $white);

// Output the image to the browser
header("Content-type: image/png");
imagepng($img);

imagedestroy($img);
?>

The above example outputs the following image:

PHP Image Processing

❮ Func Math Atan Php Is_Float Function ❯