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

List:       kde-commits
Subject:    kdeextragear-1/amarok/src
From:       Max Howell <max.howell () methylblue ! com>
Date:       2004-10-03 2:50:33
Message-ID: 20041003025033.CF53698E4 () office ! kde ! org
[Download RAW message or body]

CVS commit by mhowell: 

This contrast algo is pretty close to perfect now :-) Looks great with dark colour schemes!

CCMAIL:amarok-devel@lists.sf.net


  M +15 -15    contextbrowser.cpp   1.190


--- kdeextragear-1/amarok/src/contextbrowser.cpp  #1.189:1.190
@@ -785,12 +785,13 @@ public:
         : QColor( c )
     {
-        int h,s1,s,v;
-        getHsv( &h, &s1, &v );
+        int h,s1,s,v1,v;
+        getHsv( &h, &s1, &v1 );
 
-        kdDebug() << "first: s:" << s1 << " v:" << v << endl;
+        kdDebug() << "Initial Color Properties: s:" << s1 << " v:" << v1 << endl;
 
         //we want the new colour to be low saturation
         //TODO what if s is less than SATURATION_TARGET to start with
         s = s1 - CONTRAST;
+        v = v1;
 
         if ( s < SATURATION_TARGET ) {
@@ -798,21 +799,18 @@ public:
             s = SATURATION_TARGET;
 
+            kdDebug() << "Unapplied Contrast: " << remainingContrast << endl;
 
             //we only add to the value to avoid the dreaded "grey-gradient"
             v += remainingContrast;
 
-//          if( (255 - v) > remainingContrast )
-//              v += remainingContrast;
-//          else
-//              v -= remainingContrast;
-
             if ( v > 255 ) {
                 int error = v - 255;
-                kdDebug() << error << endl;
-
-                //don't overly saturate this, trust me
-                if( s1 + error < 128 )
-                   s = s1 + error;
+                kdDebug() << "Over-compensation: " << error << endl;
 
+                //if the error is significant then this must be a pretty bright colour
+                //it would look better if the gradient was dark
+                if( error > CONTRAST/2 )
+                   v = v1 - error;
+                else
                 v = 255;
             }
@@ -821,5 +819,5 @@ public:
         setHsv( h, s, v );
 
-        kdDebug() << "after: s:" << s << " v:" << v << endl;
+        kdDebug() << "Final Colour Properties: s:" << s << " v:" << v << endl;
     }
 };
@@ -828,4 +826,6 @@ public:
 void ContextBrowser::setStyleSheet()
 {
+    kdDebug() << k_funcinfo << endl;
+
     int pxSize = fontMetrics().height() - 4;
 


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

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