--- a/ImageEditor.st Sat Sep 28 07:15:33 2002 +0200
+++ b/ImageEditor.st Mon Sep 30 15:42:48 2002 +0200
@@ -2202,17 +2202,33 @@
!ImageEditor methodsFor:'data access'!
+atColor:aOldColor put:aNewColor
+ "a color changed to a new color
+ "
+ |index list|
+
+ list := self listOfColors.
+ index := list identityIndexOf:aOldColor.
+
+ index ~~ 0 ifTrue:[
+ list at:index put:aNewColor
+ ] ifFalse:[
+ self halt:'should not happen'.
+ list add:aNewColor
+ ].
+!
+
blueAtColor:aColor put:newBlue
"helper used to return a new row element, when blue is changed"
|byte|
- aColor isNil ifTrue:[^ aColor]. "/ mask cannot be changed
+ aColor isNil ifTrue:[^ self]. "/ mask cannot be changed
byte := newBlue clampBetween:0 and:255.
- byte = aColor blueByte ifTrue:[^ aColor].
- ^ Color redByte:(aColor redByte) greenByte:(aColor greenByte) blueByte:byte
-
- "Modified: / 18.8.1998 / 17:00:12 / cg"
+ byte = aColor blueByte ifTrue:[^ self ].
+
+ self atColor:aColor
+ put:(Color redByte:(aColor redByte) greenByte:(aColor greenByte) blueByte:byte).
!
blueFromColor:aColor
@@ -2251,12 +2267,12 @@
|byte|
- aColor isNil ifTrue:[^ aColor]. "/ mask cannot be changed
+ aColor isNil ifTrue:[^ self]. "/ mask cannot be changed
byte := newGreen clampBetween:0 and:255.
- byte = aColor greenByte ifTrue:[^ aColor].
- ^ Color redByte:(aColor redByte) greenByte:byte blueByte:(aColor blueByte)
-
- "Modified: / 18.8.1998 / 17:00:38 / cg"
+ byte = aColor greenByte ifTrue:[^ self].
+
+ self atColor:aColor
+ put:(Color redByte:(aColor redByte) greenByte:byte blueByte:(aColor blueByte)).
!
greenFromColor:aColor
@@ -2274,12 +2290,12 @@
|byte|
- aColor isNil ifTrue:[^ aColor]. "/ mask cannot be changed
+ aColor isNil ifTrue:[^ self]. "/ mask cannot be changed
byte := newRed clampBetween:0 and:255.
- byte = aColor redByte ifTrue:[^ aColor].
- ^ Color redByte:byte greenByte:(aColor greenByte) blueByte:(aColor blueByte)
-
- "Modified: / 18.8.1998 / 17:00:49 / cg"
+ byte = aColor redByte ifTrue:[^ self].
+
+ self atColor:aColor
+ put:(Color redByte:byte greenByte:(aColor greenByte) blueByte:(aColor blueByte)).
!
redFromColor:aColor