posso convertire RGB valori HSV con il seguente codice ...PHP HSV a RGB comprensione formula
$r = $r/255;
$g = $g/255;
$b = $b/255;
$h = 0;
$s = 0;
$v = 0;
$min = min(min($r, $g),$b);
$max = max(max($r, $g),$b);
$r = $max-$min;
$v = $max;
if($r == 0){
$h = 0;
$s = 0;
}
else {
$s = $r/$max;
$hr = ((($max - $r)/6) + ($r/2))/$r;
$hg = ((($max - $g)/6) + ($r/2))/$r;
$hb = ((($max - $b)/6) + ($r/2))/$r;
if ($r == $max) $h = $hb - $hg;
else if($g == $max) $h = (1/3) + $hr - $hb;
else if ($b == $max) $h = (2/3) + $hg - $hr;
if ($h < 0)$h += 1;
if ($h > 1)$h -= 1;
}
Ma come si fa a convertire HSV-RGB in PHP ???
Quello che segue è su wikipedia, ma io non lo capisco,
Sto indovinando che è abbastanza evidente
Ci sono formule qui: http://en.wikipedia.org/wiki/HSV_color_space#Conversion_from_RGB_to_HSL_or_HSV – NullUserException
lo so, ma qualcuno può spiegare le formule –
'la formula ** ** davvero lavorando per voi? Perché hai reintrodotto la variabile $ r (niente come il linguaggio dinamico ...). – greenoldman