|
|
 |
imagearc (PHP 3, PHP 4 , PHP 5) imagearc -- 画椭圆弧 说明int imagearc ( resource image, int cx, int cy, int w, int h, int s, int e, int color)
imagearc() 以
cx,cy(图像左上角为 0, 0)为中心在
image 所代表的图像中画一个椭圆弧。w
和 h 分别指定了椭圆的宽度和高度,起始和结束点以
s 和 e
参数以角度指定。0°位于三点钟位置,以逆时针方向绘画。
例子 1. 用 imagearc() 画一个圆 |
<?php
// create a 200*200 image
$img = imagecreate(200, 200);
// allocate some colors
$white = imagecolorallocate($img, 255, 255, 255);
// draw a white circle
imagearc($img, 100, 100, 150, 150, 0, 360, $white);
// output image in the browser
header("Content-type: image/png");
imagepng($img);
// free memory
imagedestroy($img);
?>
|
|
参见 imageellipse(),imagefilledellipse()
和 imagefilledarc()。
travis at duluth dot com
23-Dec-1999 10:36
The wierd thing is that the first two integers tell where to place the
"circle".
So for example I first create the
"pallet" to place the circle on.
$image = imagecreate(500,
500);
(this makes a huge 500x500 gif :) )
$colorBody =
imagecolorallocate($image, 0, 0, 0);
(make the default color of the
"pallet" black
$circleColor = imagecolorallocate($image, 255,
0, 255);
(going to make the circle an ugly pink
color)
imagearc($image, 250, 250, 300, 300, 0, 360,
$circleColor);
Places the image in the center (250,250) and the circle
is 300 pixels in diameter.
Hope this helps.
Travis Kent
Beste
| |