imagefilledarc() 부분 호를 그리고 채우는 데 사용되는 PHP의 내장 함수입니다.
구문
bool imagefilledarc($image, $cx, $cy, $width, $height, $start, $end, $color, $style)
매개변수
imagefilledarc() $image, $cx, $cy, $width, $height, $start, $end, $color, $style의 9가지 매개변수를 사용합니다.
-
$이미지 - 이미지 생성 함수 imagecreatetruecolor()에 의해 반환됩니다. 이 함수는 이미지의 크기를 만드는 데 사용됩니다.
-
$cx − 중심의 x 좌표를 설정합니다.
-
$cy − 중심의 y 좌표를 설정합니다.
-
$너비 − 호 너비를 설정합니다.
-
$높이 − 호 높이를 설정합니다.
-
$start − 시작 각도(도).
-
$end − 호 끝 각도(도). 00은 3시 위치에 있으며 호는 시계 방향으로 그려집니다.
-
$color − imagecolorallocate() 함수로 생성한 색상 식별자입니다.
-
$스타일 − 이미지를 채우는 방법을 제안하며 해당 값은 다음 목록에 있는 모든 사람이 될 수 있습니다. −
-
IMG_ARC_PIE
-
IMG_ARC_CHORD
-
IMG_ARC_NOFILL
-
IMG_ARC_EDGED
-
IMG_ARC_PIE 둘 다 및 IMG_ARC_CHORD 상호 배타적입니다.
IMG_ARC_CHORD 시작 각도와 끝 각도에서 직선을 연결하는 반면 IMG_ARC_PIE 둥근 모서리를 생성합니다.
IMG_ARC_NOFILL 호 또는 현이 채워져 있지 않고 윤곽선이 되어야 함을 나타냅니다.
IMG_ARC_EDGED IMG_ARC_NOFILL과 함께 사용됩니다. , 시작 및 끝 각도가 중심에 연결되어야 함을 나타냅니다.
반환 값
성공하면 True, 실패하면 False를 반환합니다.
예시 1
<?php
define("WIDTH", 700);
define("HEIGHT", 550);
// Create the image.
$image = imagecreate(WIDTH, HEIGHT);
// Allocate colors.
$bg = $white = imagecolorallocate($image, 0x00, 0x00, 0x80);
$gray = imagecolorallocate($image, 122, 122, 122);
// make pie arc.
$center_x = (int)WIDTH/2;
$center_y = (int)HEIGHT/2;
imagerectangle($image, 0, 0, WIDTH-2, HEIGHT-2, $gray);
imagefilledarc($image, $center_x, $center_y, WIDTH/2,
HEIGHT/2, 0, 220, $gray, IMG_ARC_PIE);
// Flush image.
header("Content-Type: image/gif");
imagepng($image);
?> 출력

예시 2
<?php
// Created the image using imagecreatetruecolor function.
$image = imagecreatetruecolor(700, 300);
// Allocated the darkgray and darkred colors
$darkgray = imagecolorallocate($image, 0x90, 0x90, 0x90);
$darkred = imagecolorallocate($image, 0x90, 0x00, 0x00);
// Make the 3D effect
for ($i = 60; $i > 50; $i--) {
imagefilledarc($image, 100, $i, 200, 100, 75, 360, $darkred, IMG_ARC_PIE);
}
imagefilledarc($image, 100, $i, 200, 100, 45, 75 , $darkgray, IMG_ARC_PIE);
// flush image
header('Content-type: image/gif');
imagepng($image);
imagedestroy($image);
?> 출력
