Backend Development 4 min read

PHP imagefilledarc Function: Drawing and Filling Elliptical Arcs

This article explains the PHP GD library function imagefilledarc, detailing its parameters, return values, and providing a complete example that creates a PNG image with filled elliptical arcs and a simple 3‑D effect.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
PHP imagefilledarc Function: Drawing and Filling Elliptical Arcs

imagefilledarc is a PHP GD library function that draws a filled elliptical arc on a given image resource.

Parameters

resource $image – image resource created by functions such as imagecreatetruecolor().

int $cx – x-coordinate of the center.

int $cy – y-coordinate of the center.

int $width – width of the ellipse.

int $height – height of the ellipse.

int $start – start angle in degrees.

int $end – end angle; 0° is at three‑o’clock and the arc is drawn clockwise.

int $color – color identifier allocated with imagecolorallocate().

int $style – bitwise OR of IMG_ARC_PIE, IMG_ARC_CHORD, IMG_ARC_NOFILL, IMG_ARC_EDGED.

Return value

Returns the image resource on success, or FALSE on failure.

Example

50; $i--) {
    imagefilledarc($image, 50, $i, 100, 50, 0, 45, $darknavy, IMG_ARC_PIE);
    imagefilledarc($image, 50, $i, 100, 50, 0, 45, $darkgray, IMG_ARC_PIE);
    imagefilledarc($image, 50, $i, 100, 50, 0, 45, 360, $darkred, IMG_ARC_PIE);
}
imagefilledarc($image, 50, 50, 100, 50, 0, 45, $navy, IMG_ARC_PIE);
imagefilledarc($image, 50, 50, 100, 50, 0, 45, $gray, IMG_ARC_PIE);
imagefilledarc($image, 50, 50, 100, 50, 0, 45, $red, IMG_ARC_PIE);
// Output image
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?>

The script outputs a PNG image showing several filled arcs that create a simple 3‑D effect.

backendimage-processingphpdrawingGD Library
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.