PHP imagearc function
Like this blog? Consider exploring one of our sponsored banner ads...
imagearc
(PHP 3, PHP 4, PHP 5)
imagearc — Draws an arcDescriptionbool imagearc ( resource image, int cx, int cy, int width, int height, int start, int end, int color )
imagearc() draws an arc of circle centered at the given
coordinates.
image
An image resource, returned by one of the image creation functions,
such as imagecreatetruecolor().
x-coordinate of the center
y-coordinate of the center
The arc width
The arc height
The arc start angle, in degrees.
The arc end angle, in degrees.
0° is located at the three-o’clock position, and the arc is drawn
clockwise.
A color identifier created with
imagecolorallocate()
Return Values
Returns TRUE on success or FALSE on failure.
Example 1. Drawing a circle with imagearc()
// create a 200*200 image $img = imagecreatetruecolor(200, 200); // allocate some colors $white = imagecolorallocate($img, 255, 255, 255); $red = imagecolorallocate($img, 255, 0, 0); $green = imagecolorallocate($img, 0, 255, 0); $blue = imagecolorallocate($img, 0, 0, 255); // draw the head imagearc($img, 100, 100, 200, 200, 0, 360, $white); // mouth imagearc($img, 100, 100, 150, 150, 25, 155, $red); // left and then the right eye imagearc($img, 60, 75, 50, 50, 0, 360, $green); imagearc($img, 140, 75, 50, 50, 0, 360, $blue); // output image in the browser header("Content-type: image/png"); imagepng($img); // free memory imagedestroy($img);
The above example will output
something similar to:
See Also
imagefilledarc()imageellipse()imagefilledellipse()
About this entry
You’re currently reading “PHP imagearc function,” an entry on BRADINO
- Published:
- 2.26.07 / 1am
- Category:
- PHP Functions
- Tags:
No comments
Jump to comment form | comments rss [?] | trackback uri [?]