when lighting/darkening colors, take the average in the topLeft
authorClaus Gittinger <cg@exept.de>
Sat, 24 Apr 1999 18:57:12 +0200
changeset 1875 745aed60b0b2
parent 1874 6ff31b38d752
child 1876 d229519bc782
when lighting/darkening colors, take the average in the topLeft corner (in case its a big image)
Button.st
Scroller.st
--- a/Button.st	Sat Apr 24 18:55:54 1999 +0200
+++ b/Button.st	Sat Apr 24 18:57:12 1999 +0200
@@ -1462,10 +1462,10 @@
     something isColor ifTrue:[
         device hasGrayscales ifTrue:[
             halfLightColor notNil ifTrue:[
-                halfLightColor := something lightened "on:device".
+                halfLightColor := (something averageColorIn:(0@0 corner:7@7)) lightened "on:device".
             ].
             halfShadowColor notNil ifTrue:[
-                halfShadowColor := something darkened "on:device".
+                halfShadowColor := (something averageColorIn:(0@0 corner:7@7)) darkened "on:device".
             ]
         ]
     ].
@@ -2240,5 +2240,5 @@
 !Button class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.109 1999-04-24 12:49:45 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.110 1999-04-24 16:57:12 cg Exp $'
 ! !
--- a/Scroller.st	Sat Apr 24 18:55:54 1999 +0200
+++ b/Scroller.st	Sat Apr 24 18:57:12 1999 +0200
@@ -973,12 +973,15 @@
 
     <resource: #style (#name)>
 
+    |avgColor|
+
     thumbColor := aColor on:device.
     (styleSheet name ~~ #normal) ifTrue:[
-	thumbShadowColor := aColor darkened on:device.
-	thumbLightColor := aColor lightened on:device.
-	thumbHalfShadowColor := thumbShadowColor darkened on:device.
-	thumbHalfLightColor := thumbLightColor lightened on:device.
+        avgColor := aColor averageColorIn:(0@0 corner:7@7).
+        thumbShadowColor := avgColor darkened on:device.
+        thumbLightColor := avgColor lightened on:device.
+        thumbHalfShadowColor := thumbShadowColor darkened on:device.
+        thumbHalfLightColor := thumbLightColor lightened on:device.
     ].
     self invalidate
 
@@ -2308,5 +2311,5 @@
 !Scroller class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.124 1999-04-24 14:37:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.125 1999-04-24 16:57:01 cg Exp $'
 ! !