Colormap.st
changeset 3840 5121ec4d4955
parent 3276 9ed39f7e7282
child 3844 6640f9dd4b9e
--- a/Colormap.st	Fri Apr 04 19:18:09 2003 +0200
+++ b/Colormap.st	Fri Apr 04 19:21:46 2003 +0200
@@ -376,6 +376,24 @@
     "Created: 6.3.1997 / 15:45:39 / cg"
 !
 
+isGreyscaleColormap
+    "return true, if the receiver is actually a greymap.
+     Could be used to convert images as read from imageFiles
+     (for example, GIF-files) automatically to greyScale (which is not yet done)."
+
+    |sz "{ Class: SmallInteger }"
+     redVal|
+
+    sz := redVector size.
+
+    1 to:sz do:[:i |
+        redVal := redVector at:i.
+        redVal ~~ (greenVector at:i) ifTrue:[^ false].
+        redVal ~~ (blueVector at:i) ifTrue:[^ false].
+    ].
+    ^ true
+!
+
 size
     "return the number of colors in the receiver"
 
@@ -387,5 +405,5 @@
 !Colormap class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Colormap.st,v 1.29 2000-08-31 10:02:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Colormap.st,v 1.30 2003-04-04 17:21:46 cg Exp $'
 ! !