PHP Draw an arc method, PHP draw arc _php Tutorial

Source: Internet
Author: User
Tags image identifier

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 ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.