PhpDig.net

What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.




imagearc

Name

imagearc — Draws an arc or ellipse.

Synopsis

int imagearc(image, start-x, start-y, width, height, degrees start, degrees end, color);
int image: Image identifier
int start-x: Starting x coordinate
int start-y: Starting y coordinate
int width: Width of arc
int height: Height of arc
int degrees start: Starting angle
int degrees end: Ending angle
int color: Color

Returns

Always TRUE

Description

imagearc() draws an arc or ellipse of the specified color, centered at the x and y starting points. The height and width represent the major and minor axes of the ellipse, respectively. The hardest part to grasp of imagearc() is how the start and end angles work. 0 angle is the right-hand end of the minor axis of the ellipse. From there, the angle travels around the circumference of the ellipse, moving down and around to the left. Specifying a start angle of 0 and an ending angle of 90, for example, would create an arc starting at the middle right and ending at the lower left. A start of 180 and end of 270 would create a similarly-sized arc that has been rotated 180 degrees around the center of the ellipse. To draw a full ellipse, specify a start angle of 0 and an end angle of 360.

Example

Example 390. Create arcs

header("Content-type: image/png");
$im = imagecreate(200, 200);
$red = imagecolorallocate($im, 255, 0, 0);
$white = imagecolorallocate($im, 255, 255, 255);
$green = imagecolorallocate($im, 0, 255, 0);
imagefill($im, 0, 0, $red);
imagearc($im,100, 100, 180, 150, 0, 360, $white);
imagearc($im,100, 100, 70, 90, 90, 270, $green);
imagearc($im,100, 100, 50, 50, 270, 90, $green);
imagepng($im);
imagedestroy($im);



PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). The authors of this book have elected not to choose any options under the OPL. This online book was obtained from http://www.fooassociates.com/phpfer/ and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.