@@ 4969-4973 (lines=5) @@ | ||
4966 | if( $max !== $min ){ |
|
4967 | $s = $l > 0.5 ? $d / (2 - $max - $min) : $d / ($max + $min); |
|
4968 | ||
4969 | switch ($max) { |
|
4970 | case $r: $h = ($g - $b) / $d + ($g < $b ? 6 : 0); break; |
|
4971 | case $g: $h = ($b - $r) / $d + 2; break; |
|
4972 | case $b: $h = ($r - $g) / $d + 4; break; |
|
4973 | } |
|
4974 | $h /= 6; |
|
4975 | } |
|
4976 | return array('h' => $h * 360, 's' => $s, 'l' => $l, 'a' => $a ); |
|
@@ 5000-5004 (lines=5) @@ | ||
4997 | ||
4998 | $h = 0; |
|
4999 | if( $max !== $min ){ |
|
5000 | switch($max){ |
|
5001 | case $r: $h = ($g - $b) / $d + ($g < $b ? 6 : 0); break; |
|
5002 | case $g: $h = ($b - $r) / $d + 2; break; |
|
5003 | case $b: $h = ($r - $g) / $d + 4; break; |
|
5004 | } |
|
5005 | $h /= 6; |
|
5006 | } |
|
5007 | return array('h'=> $h * 360, 's'=> $s, 'v'=> $v, 'a' => $a ); |