Php draw an arc method, php draw an arc _ PHP Tutorial

Source: Internet
Author: User
Tags image identifier
Php draws an arc. php draws an arc. Php draws an arc. This article describes how php draws an arc. Share it with you for your reference. The specific method is as follows: the arc is equivalent to the method of drawing an arc in the Oval php, and the php draws an arc.

This example describes how to draw an arc in php. Share it with you for your reference. The details are as follows:

An arc is equivalent to intercepting a part of an ellipse. The code is as follows:

The code is as follows:

<? Php
// 1. create a canvas
$ Im = imagecreatetruecolor (300,200); // create a real-color image. the default background is black and the image identifier is returned. Another function, imagecreate, is not recommended.
// 2. draw the desired image
$ Red = imagecolorallocate ($ im, 255, 0, 0); // create a color for use
Imagearc ($ im, 0,120, $ red); // draw an arc (an elliptical or circular is a special arc ). The parameter is equivalent to intercepting a part of an elliptical/circular shape. (0,120) indicates the center point; () indicates the width and height of the (elliptical); (): 0 indicates the start point, the center point is horizontal to the right line, intersection with the arc, is 0. 120 indicates that the clockwise rotation starts from the starting point to 120 degrees (Special: when it is 360, it is equivalent to turning a circle to get a circle ).
// 3. output image
Header ("content-type: image/png ");
Imagepng ($ im); // output to the page. If the second parameter [, $ filename] exists, the image is saved.
// 4. destroy images and release memory
Imagedestroy ($ im );
?>

I hope this article will help you with php programming.

Examples in this article describes how to draw an arc in php. Share it with you for your reference. The specific steps are as follows: the arc is equivalent to intercepting an elliptical...

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.