Image.st
changeset 6308 6e4008b97f64
parent 6305 f95708ed5bcb
child 6311 0986d91407d9
--- a/Image.st	Tue Mar 04 23:17:24 2014 +0100
+++ b/Image.st	Tue Mar 04 23:20:41 2014 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
@@ -2283,6 +2281,24 @@
 
 !
 
+colorsFromArray:anArrayOfRGBTriples
+    "for squeak compatibility with ColorForm:
+     set the colorMap from an array of rgb triples, each value being in 0..1."
+
+    |newMap|
+
+    newMap := Colormap new:anArrayOfRGBTriples size.
+    anArrayOfRGBTriples doWithIndex:[:rgb :i |
+        newMap at:i putRGBTriple:rgb
+    ].
+    self colorMap:newMap.
+
+    "
+     Depth8Image new
+        colorsFromArray:#( (0.5 0.5 0.5) (0.25 0.0 0.0) (0.0 0.25 0.5))
+    "
+!
+
 fill:aRectangle fillColor:aColor
     "fill the rectangular area specified by aRectangle with the given color"
 
@@ -14371,11 +14387,11 @@
 !Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.448 2014-03-02 14:38:29 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.449 2014-03-04 22:20:41 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.448 2014-03-02 14:38:29 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.449 2014-03-04 22:20:41 cg Exp $'
 ! !