이미지 처리 및 GD imagefill
(PHP 4, PHP 5, PHP 7, PHP 8)
imagefill — Flood fill
설명
imagefill( GdImage $image, int $x, int $y, int $color ): bool
image
의 주어진 color
으로 주어진 좌표(왼쪽 상단은 0, 0)에서 시작하여 채우기를 수행합니다.
매개변수
image
- imagecreatetruecolor()와 같은 이미지 생성 함수 중 하나에서 반환되는 GdImage 객체.
x
- 시작점의 x 좌표.
y
- 시작점의 y 좌표.
color
- 채우기 색상입니다. imagecolorallocate()로 생성된 색상 식별자입니다.
반환 값
성공하면 true
를, 실패하면 false
를 반환합니다.
변경 로그
버전 | 설명 |
---|---|
8.0.0 | image 는 이제 GdImage 인스턴스를 예상합니다. 이전에는 리소스가 필요했습니다. |
Examples
예제 #1 imagefill() 예제
<?php
$im = imagecreatetruecolor(100, 100);
// sets background to red
$red = imagecolorallocate($im, 255, 0, 0);
imagefill($im, 0, 0, $red);
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
위의 예는 다음과 유사한 결과를 출력합니다.
기타
- imagecolorallocate() - 이미지에 색상 할당