[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    www/areas/accessibility
From:       Olaf Schmidt <ojschmidt () kde ! org>
Date:       2006-07-24 16:37:58
Message-ID: 1153759078.589874.18940.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 565843 by ojschmidt:

test new saturation formula

 M  +23 -13    oxygen.php  


--- trunk/www/areas/accessibility/oxygen.php #565842:565843
@@ -81,22 +81,32 @@
     $color ["blueL"] = pow ($color ["blue256"]/255, 2.2);
     $color ["hex"] = sprintf ("#%'02X%'02X%'02X", $color ["red256"], $color \
["green256"], $color ["blue256"]);  
+    $color ["luminosity"] = 0.2126 * $color ["redL"] + 0.7152 * $color ["greenL"] + \
0.0722 * $color ["blueL"]; +
+    $color ["brightness"] = (299 * $color ["red256"] + 587 * $color ["green256"] + \
114 * $color ["blue256"]) / 1000; +
     $max = max ($color ["redL"], $color ["greenL"], $color ["blueL"]);
     $min = min ($color ["redL"], $color ["greenL"], $color ["blueL"]);
-    if ($max == $min)
-       $color ["hue"] = "-"; // do nothing
-    elseif ($max == $color ["greenL"])
-       $color ["hue"] = ($color ["blueL"] - $color ["redL"]) / ($max - $min) / 6 + \
                1/3;
-    elseif ($max == $color ["blueL"])
-       $color ["hue"] = ($color ["redL"] - $color ["greenL"]) / ($max - $min) / 6 + \
                2/3;
-    elseif ($color ["greenL"] < $color ["blueL"])
-       $color ["hue"] = ($color ["greenL"] - $color ["blueL"]) / ($max - $min) / 6 + \
                1;
-    else
-       $color ["hue"] = ($color ["greenL"] - $color ["blueL"]) / ($max - $min) / 6;
+    $med = $color ["redL"] + $color ["greenL"] + $color ["blueL"] - $max - $min;
 
-    $color ["saturation"] = $max == 0 ? 0 : 1 - $min / $max;
-    $color ["luminosity"] = 0.2126 * $color ["redL"] + 0.7152 * $color ["greenL"] + \
                0.0722 * $color ["blueL"];
-    $color ["brightness"] = (299 * $color ["red256"] + 587 * $color ["green256"] + \
114 * $color ["blue256"]) / 1000; +    $color ["hue"] = ($med - $min) / ($max - \
$min); +    $color ["saturation"] = 0;
+
+//     if ($max == $min) {
+//        $color ["hue"] = "-";
+//        $color ["saturation"] = 0;
+//     }
+//     elseif ($max == $color ["greenL"]) {
+//        $color ["hue"] = ($color ["blueL"] - $color ["redL"]) / ($max - $min) / 6 \
+ 1/3; +//        if ($min == $color ["blueL"])
+//          $color ["saturation"] = 
+//     } elseif ($max == $color ["blueL"]) {
+//        $color ["hue"] = ($color ["redL"] - $color ["greenL"]) / ($max - $min) / 6 \
+ 2/3; +//     } elseif ($color ["greenL"] < $color ["blueL"]) {
+//        $color ["hue"] = ($color ["greenL"] - $color ["blueL"]) / ($max - $min) / \
6 + 1; +//     } else
+//        $color ["hue"] = ($color ["greenL"] - $color ["blueL"]) / ($max - $min) / \
6; +
 }
 
 function printTableLine (const $colors, const $color, const $name, const $tablename) \
{


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic