#BUGFIX by cg
authorClaus Gittinger <cg@exept.de>
Fri, 03 Feb 2017 11:51:27 +0100
changeset 7831 460d842964af
parent 7830 fa41edb7876a
child 7832 9f302a33066b
#BUGFIX by cg class: Color comment/format in: #alphaMixed:with: #bitPatternForDepth: #colorForInsets #darker #lighter #muchDarker #muchLighter #newTileMorphRepresentative #scaledPixelValue32 #veryMuchLighter changed: #asByteArray #wheel: fix
Color.st
--- a/Color.st	Fri Feb 03 11:32:11 2017 +0100
+++ b/Color.st	Fri Feb 03 11:51:27 2017 +0100
@@ -3834,7 +3834,8 @@
 !Color methodsFor:'Compatibility-Squeak'!
 
 alphaMixed: proportion with: aColor
-    "Answer this color mixed with the given color. The proportion, a number
+    "Squeak compatibility:
+     Answer this color mixed with the given color. The proportion, a number
      between 0.0 and 1.0, determines what what fraction of the receiver to
      use in the mix. For example, 0.9 would yield a color close to the
      receiver. This method uses RGB interpolation; HSV interpolation can lead
@@ -3856,18 +3857,20 @@
     "
 
     "Created: / 06-06-2007 / 10:53:25 / cg"
+    "Modified (comment): / 03-02-2017 / 11:37:53 / cg"
 !
 
 bitPatternForDepth: depth
-    "Return a Bitmap, possibly containing a stipple pattern,
+    "Squeak compatibility:
+     Return a Bitmap, possibly containing a stipple pattern,
      that best represents this color at the given depth.
      BitBlt calls this method to convert colors into Bitmaps.
      The resulting Bitmap may be multiple words to represent a stipple
      pattern of several lines.  "
 
     "See also:
-	pixelValueAtDepth:      -- value for single pixel
-	pixelWordAtDepth:       -- a 32-bit word filled with the pixel value"
+        pixelValueAtDepth:      -- value for single pixel
+        pixelWordAtDepth:       -- a 32-bit word filled with the pixel value"
     "Details: The pattern for the most recently requested depth is cached."
 
 ^ self.
@@ -3878,14 +3881,20 @@
 "/    depth = 1 ifTrue: [^ cachedBitPattern _ self halfTonePattern1].
 "/    depth = 2 ifTrue: [^ cachedBitPattern _ self halfTonePattern2].
 
+    "Modified (comment): / 03-02-2017 / 11:38:04 / cg"
 !
 
 colorForInsets
+    "Squeak compatibility - dummy"
+
     ^ self
+
+    "Modified (comment): / 03-02-2017 / 11:38:24 / cg"
 !
 
 darker
-    "return a new color, which is darker than the receiver.
+    "Squeak compatibility;
+     return a new color, which is darker than the receiver.
      Almost the same as darkened for Squeak compatibility."
 
     ^ self mixed:0.8333 with:Black
@@ -3895,12 +3904,13 @@
      (Color red) muchDarker
     "
 
-    "Modified: 11.6.1996 / 18:10:37 / cg"
-
+    "Modified: / 11-06-1996 / 18:10:37 / cg"
+    "Modified (comment): / 03-02-2017 / 11:38:42 / cg"
 !
 
 lighter
-    "return a new color, which is slightly lighter than the receiver.
+    "Squeak compatibility;
+     return a new color, which is slightly lighter than the receiver.
      Almost the same as lightened for Squeak compatibility."
 
     ^ self mixed:0.8333 with:White
@@ -3912,12 +3922,13 @@
      (Color red) veryMuchLighter
     "
 
-    "Modified: 11.6.1996 / 18:10:49 / cg"
+    "Modified: / 11-06-1996 / 18:10:49 / cg"
+    "Modified (comment): / 03-02-2017 / 11:38:47 / cg"
 !
 
 muchDarker
-    "return a new color, which is much darker than the receiver.
-     Added for Squeak compatibility."
+    "Squeak compatibility:
+     return a new color, which is much darker than the receiver"
 
     ^ self mixed:0.233 with:Black
 
@@ -3926,12 +3937,13 @@
      (Color red) muchDarker
     "
 
-    "Modified: 11.6.1996 / 18:10:49 / cg"
+    "Modified: / 11-06-1996 / 18:10:49 / cg"
+    "Modified (comment): / 03-02-2017 / 11:37:46 / cg"
 !
 
 muchLighter
-    "return a new color, which is much lighter than the receiver.
-     Added for Squeak compatibility."
+    "Squeak compatibility:
+     return a new color, which is much lighter than the receiver"
 
     ^ self mixed:0.233 with:White
 
@@ -3942,11 +3954,8 @@
      (Color red) veryMuchLighter
     "
 
-    "Modified: 11.6.1996 / 18:10:49 / cg"
-!
-
-newTileMorphRepresentative
-	^ ColorTileMorph new colorSwatchColor: self
+    "Modified: / 11-06-1996 / 18:10:49 / cg"
+    "Modified (comment): / 03-02-2017 / 11:39:05 / cg"
 !
 
 privateBlue
@@ -3971,15 +3980,31 @@
 !
 
 scaledPixelValue32
+    "Squeak compatibility:
+     return the argb byteValues packed into a 32bit integer;
+     The returned value is composed of a<<24 + r<<16 + g<<8 + b.
+     This is similar to rgbValue, but has an additional alpha byte value
+     in its high bits (which is 0 for fully transparent, 255 for fully opaque colors)"
+
     ^ (self redByte bitShift:16)
       + (self greenByte bitShift:8)
       + (self blueByte)
       + (self alphaByte bitShift:24)
+
+
+    "
+     Color yellow scaledPixelValue
+     Color yellow rgbValue
+     Color yellow alpha
+     Color yellow alphaByte
+    "
+
+    "Modified (comment): / 03-02-2017 / 11:40:03 / cg"
 !
 
 veryMuchLighter
-    "return a new color, which is very much lighter than the receiver.
-     Added for Squeak compatibility."
+    "Squeak compatibility:
+     return a new color, which is very much lighter than the receiver"
 
     ^ self mixed:0.1165 with:White
 
@@ -3989,23 +4014,37 @@
      (Color red) veryMuchLighter
     "
 
-    "Modified: 11.6.1996 / 18:10:49 / cg"
+    "Modified: / 11-06-1996 / 18:10:49 / cg"
+    "Modified (comment): / 03-02-2017 / 11:40:13 / cg"
 !
 
 wheel:thisMany
-    "An array of thisMany colors around the color wheel starting at self and ending all the way around the hue space just before self.  Array is of length thisMany.  Very useful for displaying color based on a variable in your program.  "
-
-    | sat bri hue step c |
+    "Squeak compatibility:
+     An array of thisMany colors around the color wheel,
+     starting at self and ending all the way around the hue space just before self.  
+     Array is of length thisMany.  
+     Very useful for displaying color based on a variable in your program.  "
+
+    | sat l hue step c |
 
     thisMany = 1 ifTrue: [^ Array with: self].
-    sat := self saturation / 100.
-    bri := self brightness.
+    
+    sat := self saturation.
+    l := self light.
     hue := self hue.
     step := 360.0 / thisMany.
     ^ (1 to: thisMany) collect: [:num |
-            c := self class h: hue s: sat v: bri.  "hue is taken mod 360"
-            hue := hue + step.
-            c].
+        c := self class hue: hue light:l saturation: sat.  "hue is taken mod 360"
+        hue := hue + step.
+        c
+    ].
+
+    "
+     Color red wheel:20
+     Color red wheel:40
+    "
+
+    "Modified (comment): / 03-02-2017 / 11:50:59 / cg"
 ! !
 
 !Color methodsFor:'accessing'!
@@ -4551,10 +4590,15 @@
 !Color methodsFor:'converting'!
 
 asByteArray
-    ^ByteArray
-            with: self redByte
-            with: self greenByte
-            with: self blueByte
+    "return the rgb byteValues as a 3-byte byteArray #[red green blue]"
+
+    ^ self rgbBytes.
+"/    ^ByteArray
+"/            with: self redByte
+"/            with: self greenByte
+"/            with: self blueByte
+
+    "Modified: / 03-02-2017 / 11:33:23 / cg"
 !
 
 fromLiteralArrayEncoding:encoding