--- a/ColorValue.st Tue Jan 09 17:39:01 2018 +0100
+++ b/ColorValue.st Thu Jan 11 18:17:45 2018 +0100
@@ -170,35 +170,36 @@
fromLiteralArrayEncoding:encoding
"read my values from an encoding.
The encoding is supposed to be of the form:
- (#ColorValue scaledRed scaledGreen scaledBlue)
+ #(ColorValue scaledRed scaledGreen scaledBlue)
This is the reverse operation to #literalArrayEncoding."
|clr|
+ red notNil ifTrue:[
+ "oops cannot change an existing color (you want to make red be green - or what)"
+ self error:'Colors cannot change their components'.
+ ^ self
+ ].
+
encoding size == 2 ifTrue:[
clr := self class name:(encoding at:2).
red := clr scaledRed.
green := clr scaledGreen.
blue := clr scaledBlue.
] ifFalse:[
-"/ (encoding at:2) isSymbol ifTrue:[
-"/ clr := ColorValue perform:(encoding at:2) withArguments:(encoding at:3).
-"/ red := clr scaledRed.
-"/ green := clr scaledGreen.
-"/ blue := clr scaledBlue.
-"/ ] ifFalse:[
- red := (encoding at:2).
- green := (encoding at:3).
- blue := (encoding at:4).
-"/ ]
- ]
+ red := encoding at:2.
+ green := encoding at:3.
+ blue := encoding at:4.
+ ].
"
ColorValue new fromLiteralArrayEncoding:#(#Color 7700 7700 7700)
+ ColorValue new fromLiteralArrayEncoding:#(ColorValue red)
"
- "Created: 22.1.1997 / 04:18:50 / cg"
- "Modified: 6.3.1997 / 15:45:01 / cg"
+ "Created: / 22-01-1997 / 04:18:50 / cg"
+ "Modified: / 06-03-1997 / 15:45:01 / cg"
+ "Modified (comment): / 11-01-2018 / 12:32:05 / stefan"
!
literalArrayEncoding