added #canRepresent:
authorClaus Gittinger <cg@exept.de>
Thu, 27 Feb 1997 12:05:52 +0100
changeset 460 2c2215c50c28
parent 459 9cdd02f994a4
child 461 bacef118f54a
added #canRepresent:
XPMReader.st
--- a/XPMReader.st	Thu Feb 27 11:54:45 1997 +0100
+++ b/XPMReader.st	Thu Feb 27 12:05:52 1997 +0100
@@ -81,6 +81,19 @@
 
 !XPMReader class methodsFor:'testing'!
 
+canRepresent:anImage
+    "return true, if anImage can be represented in my file format.
+     Currently only images with less than 50 colors are supported."
+
+    anImage depth <= 6 ifTrue:[^ true].
+    anImage photometric == #palette ifTrue:[
+        anImage colorMap size < 50 ifTrue:[^ true].
+    ].
+    ^ anImage usedColors size < 50
+
+    "Modified: 27.2.1997 / 12:05:34 / cg"
+!
+
 isValidImageFile:aFileName
     "return true, if aFileName contains an x-bitmap-file image"
 
@@ -451,6 +464,6 @@
 !XPMReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/XPMReader.st,v 1.22 1997-02-27 10:54:45 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/XPMReader.st,v 1.23 1997-02-27 11:05:52 cg Exp $'
 ! !
 XPMReader initialize!