GradientBackground.st
changeset 5732 fba4327a852b
parent 5731 e638acae4e19
child 5733 08e2b386abef
--- a/GradientBackground.st	Wed Mar 23 18:41:13 2011 +0100
+++ b/GradientBackground.st	Thu Mar 24 09:51:49 2011 +0100
@@ -179,18 +179,23 @@
         g := g1 + (dG * y).
         dB := (b2 - b1) / hAll.
         b := b1 + (dB * y).
+        r := (r max:minR) min:maxR. 
+        g := (g max:minG) min:maxG.
+        b := (b max:minB) min:maxB.
 
         xRight := x+w-1.
+        "xRight+1 since X11 does not show the last point of a line"
+        xRight := xRight+1.
+
         y to:y+h-1 do:[:yP |
             rC := r asInteger.
             gC := g asInteger.
             bC := b asInteger.
             (rC ~~ lastR or:[gC ~~ lastG or:[bC ~~ lastB]]) ifTrue:[
-                aView foreground:(Color redByte:rC greenByte:gC blueByte:bC).
+                aView paint:(Color redByte:rC greenByte:gC blueByte:bC).
                 lastR := rC. lastG := gC. lastB := bC.
             ].
-            "xRight+1 since X11 does not show the last point of a line"
-            aView displayLineFromX:x y:yP toX:xRight+1 y:yP.
+            aView displayLineFromX:x y:yP toX:xRight y:yP.
             r := ((r + dR) max:minR) min:maxR. 
             g := ((g + dG) max:minG) min:maxG.
             b := ((b + dB) max:minB) min:maxB.
@@ -201,23 +206,28 @@
     "/ individual lines; from left to right
     (direction == #eastWest or:[direction == #horizontal]) ifTrue:[
         dR := (r2 - r1) / wAll.
-        r := r1 + (dR * y).
+        r := r1 + (dR * x).
         dG := (g2 - g1) / wAll.
-        g := g1 + (dG * y).
+        g := g1 + (dG * x).
         dB := (b2 - b1) / wAll.
-        b := b1 + (dB * y).
+        b := b1 + (dB * x).
+        r := (r max:minR) min:maxR. 
+        g := (g max:minG) min:maxG.
+        b := (b max:minB) min:maxB.
 
         yBot := y+h-1.
+        "yBot+1 since X11 does not show the last point of a line"
+        yBot := yBot+1.
         x to:x+w-1 do:[:xP |
             rC := r asInteger.
             gC := g asInteger.
             bC := b asInteger.
             (rC ~~ lastR or:[gC ~~ lastG or:[bC ~~ lastB]]) ifTrue:[
-                aView foreground:(Color redByte:rC greenByte:gC blueByte:bC).
+                aView paint:(Color redByte:rC greenByte:gC blueByte:bC).
                 lastR := rC. lastG := gC. lastB := bC.
             ].
             "yBot+1 since X11 does not show the last point of a line"
-            aView displayLineFromX:xP y:y toX:xP y:yBot+1.
+            aView displayLineFromX:xP y:y toX:xP y:yBot.
             r := ((r + dR) max:minR) min:maxR. 
             g := ((g + dG) max:minG) min:maxG.
             b := ((b + dB) max:minB) min:maxB.
@@ -226,11 +236,11 @@
     ]
 
     "Created: / 23-01-2011 / 01:59:29 / cg"
-    "Modified: / 23-03-2011 / 18:41:05 / cg"
+    "Modified: / 24-03-2011 / 09:51:31 / cg"
 ! !
 
 !GradientBackground class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/GradientBackground.st,v 1.9 2011-03-23 17:41:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/GradientBackground.st,v 1.10 2011-03-24 08:51:49 cg Exp $'
 ! !