imagearc
(PHP 4, PHP 5)
imagearc — Draws an arc
설명
bool 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.
매개변수
- font
-
내장 글꼴 1, 2, 3, 4, 5(큰 숫자가 큰 글꼴)나 imageloadfont()로 등록한 글꼴 식별자를 사용할 수 있습니다.
- cx
-
x-coordinate of the center
- cy
-
y-coordinate of the center
- width
-
The arc width
- height
-
The arc height
- start
-
The arc start angle, in degrees.
- end
-
The arc end angle, in degrees. 0° is located at the three-o'clock position, and the arc is drawn clockwise.
- color
-
A color identifier created with imagecolorallocate()
반환값
성공할 경우 TRUE를, 실패할 경우 FALSE를 반환합니다.
예제
Example#1 Drawing a circle with imagearc()
<?php
// 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);
?>
위 예제의 출력 예: