ImageMagick ImagickPixel::setHSL
(PECL imagick 2, PECL imagick 3)
ImagickPixel::setHSL — 정규화된 HSL 색상을 설정합니다.
설명
public ImagickPixel::setHSL(float $hue
, float $saturation
, float $luminosity
): bool
색조, 채도 및 광도에 대해 정규화된 값을 사용하여 ImagickPixel 개체에서 설명하는 색상을 설정합니다.
매개변수
hue
- 색조에 대한 정규화된 값으로, 색조 원의 분수 호(0과 1 사이)로 설명되며 0 값은 빨간색입니다.
saturation
- 채도에 대한 정규화된 값으로 1이 전체 채도입니다.
luminosity
- 0.5 광도에서 전체 HS 값을 사용하여 0의 검정색에서 1의 흰색까지의 척도로 광도에 대한 정규화된 값입니다.
반환 값
성공하면 true
를 반환합니다.
Examples
예제 #1 ImagickPixel::setHSL()을 사용하여 색상 수정
<?php
//Create an almost pure red color
$color = new ImagickPixel('rgb(90%, 10%, 10%)');
//Get it's HSL values
$colorInfo = $color->getHSL();
//Rotate the hue by 180 degrees
$newHue = $colorInfo['hue'] + 0.5;
if ($newHue > 1) {
$newHue = $newHue - 1;
}
//Set the ImagickPixel to the new color
$colorInfo = $color->setHSL($newHue, $colorInfo['saturation'], $colorInfo['luminosity']);
//Check that the new color is blue/green
$colorInfo = $color->getcolor();
print_r($colorInfo);
?>
위의 예는 다음을 출력합니다.
Array ( [r] => 26 [g] => 230 [b] => 230 [a] => 255 )
메모
메모: ImageMagick 라이브러리 버전 6.2.9 이상에서 사용할 수 있습니다.