Monday, December 22, 2025
HomeLanguagesPHP | ImagickDraw arc() Function

PHP | ImagickDraw arc() Function

The ImagickDraw::arc() function is an inbuilt function in Imagick library of PHP which is used to draw an arc.

Syntax:

bool ImagickDraw::arc( $sx, $sy, $ex, $ey, $sd, $ed )

Parameters: This function accepts six parameters as mentioned above and described below:

  • $sx: This parameter takes the value of starting x-ordinate.
  • $sy: This parameter takes the value of starting y-ordinate.
  • $ex:This parameter takes the value of ending x-ordinate.
  • $ey: This parameter takes the value of ending y-ordinate.
  • $sd: This parameter takes the value of starting angle of rotation in degrees.
  • $ed: This parameter takes the value of ending angle of rotation in degrees.

Return Value: This function does not return any value.

Below program illustrates the ImagickDraw::arc() function in PHP:

Program:




<?php
/*require_once('vendor/autoload.php');*/
  
// Create ImagickDraw object
$draw = new ImagickDraw();
$draw->setStrokeColor('Green');
$draw->setFillColor('Red');
$draw->setStrokeWidth(7);
  
$draw->arc(120, 30, 250, 180, 50, 190);
  
// Create an image object
  
$image = new Imagick();
$image->newImage(300, 300, 'White');
$image->setImageFormat("png");
  
// Use drawImage function
$image->drawImage($draw);
  
// Send the image to the browser
header("Content-Type: image/png");
echo $image->getImageBlob();
?>


Output:

Reference: http://php.net/manual/en/imagickdraw.arc.php

RELATED ARTICLES

Most Popular

Dominic
32456 POSTS0 COMMENTS
Milvus
111 POSTS0 COMMENTS
Nango Kala
6823 POSTS0 COMMENTS
Nicole Veronica
11958 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12038 POSTS0 COMMENTS
Shaida Kate Naidoo
6958 POSTS0 COMMENTS
Ted Musemwa
7203 POSTS0 COMMENTS
Thapelo Manthata
6911 POSTS0 COMMENTS
Umr Jansen
6890 POSTS0 COMMENTS