이미지 레이어 효과() 레이어 효과를 사용하도록 알파 혼합 플래그를 설정하는 데 사용되는 PHP의 내장 함수입니다. 성공하면 True, 실패하면 False를 반환합니다.
구문
bool imagelayereffect($image, $effect)
매개변수
이미지 레이어 효과() $image라는 두 개의 다른 매개변수를 사용합니다. 및 $효과 .
-
$이미지 - 이 매개변수는 이미지 생성 함수 imagecreatetruecolor()에 의해 반환됩니다. 이미지의 크기를 생성할 때 사용합니다.
-
$효과 − 이 매개변수는 다양한 효과 상수를 사용하여 혼합 플래그의 값을 설정하는 데 사용되며, 다음과 같습니다. −
-
IMG_EFFECT_REPLACE - 픽셀 교체를 설정하기 위해 사용합니다. imagealphablending() 함수에 true를 전달하는 것과 비슷합니다.
-
IMG_EFFETC_ALPHABLEND - 일반 픽셀 블렌딩을 설정하기 위해 사용합니다. 이것은 imagealphablending() 함수에 false를 전달하는 것과 같습니다.
-
IMG_EFFECT_NORMAL - IMG_EFFETC_ALPHABLEND와 동일합니다.
-
IMG_EFFETC_OVERLAY − IMG_EFFECT_OVERLAY를 사용하면 흰색 배경 픽셀은 흰색으로 유지되고 검은색 배경 픽셀은 검정색으로 유지되지만 회색 배경 픽셀은 전경 픽셀의 색상을 사용합니다.
-
IMG_EFFETC_MULTIPLY - 곱하기 효과를 설정합니다.
-
반환 값
이미지 레이어 효과() 성공하면 True, 실패하면 False를 반환합니다.
예시 1
<?php
// Setup an image using imagecreatetruecolor() function
$img = imagecreatetruecolor(700, 300);
// Set a background color
imagefilledrectangle($img, 0, 0, 150, 150, imagecolorallocate($img, 122, 122, 122));
// Apply the overlay alpha blending flag
imagelayereffect($img, IMG_EFFECT_OVERLAY);
// Draw two grey ellipses
imagefilledellipse($img, 50, 50, 40, 40, imagecolorallocate($img, 100, 255, 100));
imagefilledellipse($img, 50, 50, 50, 80, imagecolorallocate($img, 100, 100, 255));
imagefilledellipse($img, 50, 50, 80, 50, imagecolorallocate($img, 255, 0, 0));
// Output image
header('Content-type: image/png');
imagepng($img);
imagedestroy($img);
?> 출력

예시 2
<?php
// Setup an image using imagecreatetruecolor() function.
$img = imagecreatetruecolor(700, 200);
// Set a background color
imagefilledrectangle($img, 0, 0, 200, 200, imagecolorallocate($img, 122, 122, 122));
// Apply the overlay alpha blending flag
imagelayereffect($img, IMG_EFFECT_REPLACE);
// Draw two grey ellipses
imagefilledellipse($img,100,100,160,160, imagecolorallocate($img,0,0,0));
imagefilledellipse($img,100,100,140,140, imagecolorallocate($img,0,0,255));
imagefilledellipse($img,100,100,100,100, imagecolorallocate($img,255,0,0));
// Output image
header('Content-type: image/png');
imagepng($img);
imagedestroy($img);
?> 출력
