more signals to be raised if anything happens during
an image save operation.
--- a/PBMReader.st Thu Feb 27 12:05:52 1997 +0100
+++ b/PBMReader.st Thu Feb 27 12:50:58 1997 +0100
@@ -351,8 +351,16 @@
outStream := FileStream newFileNamed:aFileName.
outStream isNil ifTrue:[
- 'PBMREADER: create error' errorPrintNL.
- ^ nil
+ 'PBMReader [error]: file create error' errorPrintNL.
+ ^ Image fileCreationErrorSignal
+ raiseWith:image
+ errorString:('file creation error: ' , aFileName asString).
+ ].
+
+ image mask notNil ifTrue:[
+ Image informationLostQuerySignal
+ raiseWith:image
+ errorString:('PBM format does not support an imageMask').
].
width := image width.
@@ -364,17 +372,19 @@
data := image bits.
photometric == #rgb ifTrue:[
- ^ self writePNMFileOn:outStream
+ ^ self writePNMFileOn:outStream
].
samplesPerPixel == 1 ifTrue:[
- ((bitsPerSample at:1) == 1) ifTrue:[
- ^ self writePBMFileOn:outStream
- ].
- ((bitsPerSample at:1) == 8) ifTrue:[
- ^ self writePGMFileOn:outStream
- ].
+ ((bitsPerSample at:1) == 1) ifTrue:[
+ ^ self writePBMFileOn:outStream
+ ].
+ ((bitsPerSample at:1) == 8) ifTrue:[
+ ^ self writePGMFileOn:outStream
+ ].
].
- self error:'format not supported'.
+ ^ Image cannotRepresentImageSignal
+ raiseWith:image
+ errorString:('PBMReader cannot represent this image').
"
|img|
@@ -397,6 +407,8 @@
img := Image fromFile:'test.pbm'.
img inspect.
"
+
+ "Modified: 27.2.1997 / 12:45:42 / cg"
!
writePBMFileOn:aStream
@@ -439,6 +451,6 @@
!PBMReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/PBMReader.st,v 1.21 1997-02-01 14:05:30 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/PBMReader.st,v 1.22 1997-02-27 11:49:40 cg Exp $'
! !
PBMReader initialize!
--- a/ST80FormReader.st Thu Feb 27 12:05:52 1997 +0100
+++ b/ST80FormReader.st Thu Feb 27 12:50:58 1997 +0100
@@ -128,14 +128,22 @@
This is obsolete - use the XBMReader directly."
(self class canRepresent:image) ifFalse:[
- self error:'can only save Depth1Images'.
- ^ nil.
+ ^ Image cannotRepresentImageSignal
+ raiseWith:image
+ errorString:('ST80Form format only supports monochrome images').
+ ].
+
+ image mask notNil ifTrue:[
+ Image informationLostQuerySignal
+ raiseWith:image
+ errorString:('ST80Form format does not support an imageMask').
].
outStream := FileStream newFileNamed:aFileName.
outStream isNil ifTrue:[
- 'create error' printNewline.
- ^ nil
+ ^ Image fileCreationErrorSignal
+ raiseWith:image
+ errorString:('file creation error: ' , aFileName asString).
].
width := image width.
@@ -156,11 +164,13 @@
outStream close
"ST80FormReader save:(Image fromFile:'bitmaps/SBrowser.xbm') onFile:'test.form'"
+
+ "Modified: 27.2.1997 / 12:46:00 / cg"
! !
!ST80FormReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/ST80FormReader.st,v 1.16 1997-02-01 14:09:53 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/ST80FormReader.st,v 1.17 1997-02-27 11:50:58 cg Exp $'
! !
ST80FormReader initialize!
--- a/STFormRdr.st Thu Feb 27 12:05:52 1997 +0100
+++ b/STFormRdr.st Thu Feb 27 12:50:58 1997 +0100
@@ -128,14 +128,22 @@
This is obsolete - use the XBMReader directly."
(self class canRepresent:image) ifFalse:[
- self error:'can only save Depth1Images'.
- ^ nil.
+ ^ Image cannotRepresentImageSignal
+ raiseWith:image
+ errorString:('ST80Form format only supports monochrome images').
+ ].
+
+ image mask notNil ifTrue:[
+ Image informationLostQuerySignal
+ raiseWith:image
+ errorString:('ST80Form format does not support an imageMask').
].
outStream := FileStream newFileNamed:aFileName.
outStream isNil ifTrue:[
- 'create error' printNewline.
- ^ nil
+ ^ Image fileCreationErrorSignal
+ raiseWith:image
+ errorString:('file creation error: ' , aFileName asString).
].
width := image width.
@@ -156,11 +164,13 @@
outStream close
"ST80FormReader save:(Image fromFile:'bitmaps/SBrowser.xbm') onFile:'test.form'"
+
+ "Modified: 27.2.1997 / 12:46:00 / cg"
! !
!ST80FormReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/Attic/STFormRdr.st,v 1.16 1997-02-01 14:09:53 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/Attic/STFormRdr.st,v 1.17 1997-02-27 11:50:58 cg Exp $'
! !
ST80FormReader initialize!
--- a/TIFFRdr.st Thu Feb 27 12:05:52 1997 +0100
+++ b/TIFFRdr.st Thu Feb 27 12:50:58 1997 +0100
@@ -1637,8 +1637,15 @@
outStream := FileStream newFileNamed:aFileName.
outStream isNil ifTrue:[
- 'TIFFReader [warning]: create error' errorPrintCR.
- ^ nil
+ ^ Image fileCreationErrorSignal
+ raiseWith:image
+ errorString:('file creation error: ' , aFileName asString).
+ ].
+
+ image mask notNil ifTrue:[
+ Image informationLostQuerySignal
+ raiseWith:image
+ errorString:('TIFF writer does not (yet) support an imageMask').
].
"save as msb"
@@ -1717,12 +1724,12 @@
self writeLong:0. "end of tags mark"
outStream close
- "Modified: 10.1.1997 / 18:13:38 / cg"
+ "Modified: 27.2.1997 / 12:46:26 / cg"
! !
!TIFFReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.49 1997-02-20 17:17:46 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.50 1997-02-27 11:50:14 cg Exp $'
! !
TIFFReader initialize!
--- a/TIFFReader.st Thu Feb 27 12:05:52 1997 +0100
+++ b/TIFFReader.st Thu Feb 27 12:50:58 1997 +0100
@@ -1637,8 +1637,15 @@
outStream := FileStream newFileNamed:aFileName.
outStream isNil ifTrue:[
- 'TIFFReader [warning]: create error' errorPrintCR.
- ^ nil
+ ^ Image fileCreationErrorSignal
+ raiseWith:image
+ errorString:('file creation error: ' , aFileName asString).
+ ].
+
+ image mask notNil ifTrue:[
+ Image informationLostQuerySignal
+ raiseWith:image
+ errorString:('TIFF writer does not (yet) support an imageMask').
].
"save as msb"
@@ -1717,12 +1724,12 @@
self writeLong:0. "end of tags mark"
outStream close
- "Modified: 10.1.1997 / 18:13:38 / cg"
+ "Modified: 27.2.1997 / 12:46:26 / cg"
! !
!TIFFReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.49 1997-02-20 17:17:46 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.50 1997-02-27 11:50:14 cg Exp $'
! !
TIFFReader initialize!
--- a/XBMReader.st Thu Feb 27 12:05:52 1997 +0100
+++ b/XBMReader.st Thu Feb 27 12:50:58 1997 +0100
@@ -228,14 +228,22 @@
rowBytes "{ Class: SmallInteger }" |
(self class canRepresent:image) ifFalse:[
- self error:'can only save depth 1 B&W images'.
- ^ nil.
+ ^ Image cannotRepresentImageSignal
+ raiseWith:image
+ errorString:('XBM format only supports monochrome images').
+ ].
+
+ image mask notNil ifTrue:[
+ Image informationLostQuerySignal
+ raiseWith:image
+ errorString:('XBM format does not support an imageMask').
].
outStream := FileStream newFileNamed:aFileName.
outStream isNil ifTrue:[
- 'XBMReader [error]: create error' errorPrintCR.
- ^ nil
+ ^ Image fileCreationErrorSignal
+ raiseWith:image
+ errorString:('file creation error: ' , aFileName asString).
].
width := image width.
@@ -288,12 +296,12 @@
XBMReader save:(Image fromFile:'bitmaps/hello_world.icon') onFile:'test.xbm'
"
- "Modified: 10.1.1997 / 18:16:47 / cg"
+ "Modified: 27.2.1997 / 12:46:49 / cg"
! !
!XBMReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/XBMReader.st,v 1.30 1997-02-01 14:08:23 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/XBMReader.st,v 1.31 1997-02-27 11:49:56 cg Exp $'
! !
XBMReader initialize!
--- 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!
--- a/XWDReader.st Thu Feb 27 12:05:52 1997 +0100
+++ b/XWDReader.st Thu Feb 27 12:50:58 1997 +0100
@@ -189,8 +189,15 @@
|aStream rgbColor paletteColors ncolors dumpName headerSize|
(self class canRepresent:image) ifFalse:[
- self error:'XWD format only supports 8bit palette images'.
- ^ nil
+ ^ Image cannotRepresentImageSignal
+ raiseWith:image
+ errorString:('XWD format cannot represent this image').
+ ].
+
+ image mask notNil ifTrue:[
+ Image informationLostQuerySignal
+ raiseWith:image
+ errorString:('XWD format does not support an imageMask').
].
dumpName := 'stdin'.
@@ -200,6 +207,12 @@
"create the header (each item is 32 bits long)"
aStream := fileName asFilename writeStream.
+ aStream isNil ifTrue:[
+ ^ Image fileCreationErrorSignal
+ raiseWith:image
+ errorString:('file creation error: ' , fileName asString).
+ ].
+
aStream binary.
aStream nextLongPut: headerSize. "total header size in bytes"
aStream nextLongPut: 7. "XWD file version"
@@ -276,11 +289,13 @@
XWDReader save:(Image fromUser) onFile: '/tmp/st.xwd'
(Image fromFile: '/tmp/st.xwd') inspect
"
+
+ "Modified: 27.2.1997 / 12:45:15 / cg"
! !
!XWDReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/XWDReader.st,v 1.18 1997-02-01 14:05:10 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/XWDReader.st,v 1.19 1997-02-27 11:50:47 cg Exp $'
! !
XWDReader initialize!