How to draw an arc in php, how to draw an arc in php
The example in this article describes how to draw an arc in PHP. Share it with everyone for your reference. The details are as follows:
The arc is equivalent to intercepting a part of the ellipse. The code is as follows:
Copy code The code is as follows:
//1. Create canvas
$im = imagecreatetruecolor(300,200);//Create a new true color image, the default background is black, and return the image identifier. There is also a function imagecreate that has been deprecated.
//2. Draw the required image
$red = imagecolorallocate($im,255,0,0);//Create a color for use
imagearc($im,100,80,120,90,0,120,$red);//Draw an arc (ellipse or circle is a special arc). Parameter understanding is equivalent to intercepting a part of the ellipse/circle. (100,80) represents the center point; (120,90) represents the width and height of the (ellipse); (0,120): 0 represents the starting point. The center point is a horizontal straight line to the right and the intersection point with the arc is 0 point. 120 means starting from the starting point and turning 120 degrees clockwise (special: when it is 360, it is equivalent to turning around and getting a circle).
//3. Output image
header("content-type: image/png");
imagepng($im);//Output to the page. If there is a second parameter [,$filename], it means saving the image
//4. Destroy the image and release memory
imagedestroy($im);
?>
I hope this article will be helpful to everyone’s PHP programming design.
http://www.bkjia.com/PHPjc/947211.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/947211.htmlTechArticleHow to draw an arc in php, how to draw an arc in php This article describes how to draw an arc in php. Share it with everyone for your reference. The details are as follows: An arc is equivalent to intercepting an ellipse...