이미지 처리 및 GD imagelayereffect

(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)

imagelayereffect — 레이어 효과를 사용하도록 알파 혼합 플래그 설정


설명

imagelayereffect(GdImage $image, int $effect): bool

레이어 효과를 사용하려면 알파 혼합 플래그를 설정하십시오.


매개변수

image
imagecreatetruecolor()와 같은 이미지 생성 함수 중 하나에서 반환되는 GdImage 객체.
effect
다음 상수 중 하나:
IMG_EFFECT_REPLACE
픽셀 교체 사용(imagealphablending()true를 전달하는 것과 동일)
IMG_EFFECT_ALPHABLEND
일반 픽셀 혼합 사용(imagealphablending()false를 전달하는 것과 동일)
IMG_EFFECT_NORMAL
IMG_EFFECT_ALPHABLEND와 동일합니다.
IMG_EFFECT_OVERLAY
오버레이는 검은색 배경 픽셀이 검은색으로 유지되고 흰색 배경 픽셀이 흰색으로 유지되는 효과가 있지만 회색 배경 픽셀은 전경 픽셀의 색상을 사용합니다.
IMG_EFFECT_MULTIPLY
곱하기 효과가 있는 오버레이.

반환 값

성공하면 true를, 실패하면 false를 반환합니다.


변경 로그

버전 설명
8.0.0 image는 이제 GdImage 인스턴스를 반환합니다. 이전에는 리소스가 필요했습니다.
7.2.0 IMG_EFFECT_MULTIPLY가 추가되었습니다(시스템 libgd >= 2.1.1 또는 번들된 libgd 필요).

Examples

예제 #1 imagelayereffect() 예제

                  
<?php
// Setup an image
$im = imagecreatetruecolor(100, 100);

// Set a background
imagefilledrectangle($im, 0, 0, 100, 100, imagecolorallocate($im, 220, 220, 220));

// Apply the overlay alpha blending flag
imagelayereffect($im, IMG_EFFECT_OVERLAY);

// Draw two grey ellipses
imagefilledellipse($im, 50, 50, 40, 40, imagecolorallocate($im, 100, 255, 100));
imagefilledellipse($im, 50, 50, 50, 80, imagecolorallocate($im, 100, 100, 255));
imagefilledellipse($im, 50, 50, 80, 50, imagecolorallocate($im, 255, 100, 100));

// Output
header('Content-type: image/png');

imagepng($im);
imagedestroy($im);
?>
                  
                

위의 예는 다음과 유사한 결과를 출력합니다.

function imagelayereffect