PHP draws an arc method, PHP draws an arc
This example describes how PHP draws an arc. Share to everyone for your reference. Specific as follows:
The arc is equivalent to intercepting part of the ellipse. The code is as follows:
Copy the Code code as follows: <?php
1. Create a canvas
$im = Imagecreatetruecolor (300,200);//Create a new true color image, the default background is black, return the image identifier. There is also a function imagecreate has not been recommended for use.
2. Draw the desired 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). The parameter is understood, which is equivalent to intercepting the ellipse/circle part. (100,80) represents the center point; (120,90) represents (ellipse) width and height, (0,120): 0 is the starting point, the center point is horizontal to the right, and the intersection of the arc is 0 points. 120 means starting from the beginning, clockwise to 120 degrees (Special: When 360, the equivalent of a circle, to get a circle).
3. Output image
Header ("Content-type:image/png");
Imagepng ($im);//output to page. If there is a second argument [, $filename], the image is saved
4. Destroy the image and release the memory
Imagedestroy ($im);
?>
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/947211.html www.bkjia.com true http://www.bkjia.com/PHPjc/947211.html techarticle PHP to draw an arc of the method, PHP drawing the arc of this article describes the PHP method of drawing an arc. Share to everyone for your reference. The following: The arc is equivalent to intercept the ellipse ...