ImagickPixel::getHSL

(PECL imagick 2, PECL imagick 3)

ImagickPixel::getHSLImagickPixel オブジェクトの HSL カラーを正規化したものを返す

説明

public ImagickPixel::getHSL(): array

ImagickPixel オブジェクトの HSL カラーを正規化したものを返します。 3 つの値は、それぞれ 0.0 から 1.0 までの間の浮動小数点数値となります。

パラメータ

この関数にはパラメータはありません。

戻り値

HSL の値をそれぞれ "hue"、 "saturation"、そして "luminosity" というキーに保持する配列を返します。 失敗した場合に ImagickPixelException をスローします。

例1 基本的な Imagick::getHSL() の使用例

<?php

$color
= new ImagickPixel('rgb(90%, 10%, 10%)');

$colorInfo = $color->getHSL();

print_r($colorInfo);

?>

上の例の出力は以下となります。

Array
(
    [hue] => 0
    [saturation] => 0.80001220740379
    [luminosity] => 0.50000762951095
)

注意

注意:

ImageMagick ライブラリバージョン 6.2.9 以降で使用可能です。

add a note

User Contributed Notes 1 note

up
1
rio at rio dot st
14 years ago
This function needs ImageMagick > 6.2.8

In imagickpixel_class.c
#if MagickLibVersion > 0x628
/* {{{ proto array ImagickPixel::getHSL()
Returns the normalized HSL color of the pixel wand in an array with the keys "hue", "saturation", and "luminosity".
*/
To Top