--- a/XPMReader.st Thu Feb 27 12:05:52 1997 +0100
+++ b/XPMReader.st Thu Feb 27 12:50:58 1997 +0100
@@ -83,15 +83,15 @@
canRepresent:anImage
"return true, if anImage can be represented in my file format.
- Currently only images with less than 50 colors are supported."
+ Currently only images with less than 80 colors are supported."
anImage depth <= 6 ifTrue:[^ true].
anImage photometric == #palette ifTrue:[
- anImage colorMap size < 50 ifTrue:[^ true].
+ anImage colorMap size < 80 ifTrue:[^ true].
].
- ^ anImage usedColors size < 50
+ ^ anImage usedColors size < 80
- "Modified: 27.2.1997 / 12:05:34 / cg"
+ "Modified: 27.2.1997 / 12:40:22 / cg"
!
isValidImageFile:aFileName
@@ -387,25 +387,28 @@
maskColorIndex := nColors.
].
nColors > 256 ifTrue:[
- 'XPMReader [error]: cannot (yet) create multiBbyte representation (too many colors)' errorPrintCR.
- ^ nil
+ ^ Image cannotRepresentImageSignal
+ raiseWith:image
+ errorString:('XPMReader cannot represent this image (too many colors)').
].
map := ($a to: $z) asOrderedCollection.
map addAll:($A to: $Z) asOrderedCollection.
map addAll:($0 to: $9) asOrderedCollection.
- map addAll:#($. $, $`) asOrderedCollection.
+ map addAll:#($. $, $` $^ $* $: $; $< $> $? $% $# $& $( $) $- $+ $=) asOrderedCollection.
nChars := 1.
nColors > map size ifTrue:[
- 'XPMReader [error]: cannot (yet) create 2-byte representation (too many colors)' errorPrintCR.
- ^ nil
+ ^ Image cannotRepresentImageSignal
+ raiseWith:image
+ errorString:('XPMReader cannot represent this image (too many colors)').
].
outStream := FileStream newFileNamed:aFileName.
outStream isNil ifTrue:[
- 'XPMReader [warning]: create error' errorPrintCR.
- ^ nil
+ ^ Image fileCreationErrorSignal
+ raiseWith:image
+ errorString:('file creation error: ' , aFileName asString).
].
baseName := aFileName asFilename baseName asFilename withoutSuffix asString.
@@ -441,7 +444,7 @@
0 to:image height-1 do:[:y |
outStream nextPutAll:'"'.
0 to:image width-1 do:[:x |
- |clr isMasked idx|
+ |clr idx|
maskColorIndex notNil ifTrue:[
isMasked := (imageMask valueAtX:x y:y) == 0
@@ -458,12 +461,12 @@
].
outStream nextPutLine:'};'
- "Modified: 27.2.1997 / 11:49:34 / cg"
+ "Modified: 27.2.1997 / 12:47:01 / cg"
! !
!XPMReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/XPMReader.st,v 1.23 1997-02-27 11:05:52 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/XPMReader.st,v 1.24 1997-02-27 11:50:32 cg Exp $'
! !
XPMReader initialize!