126 save:image onFile:aFileName |
126 save:image onFile:aFileName |
127 "save image as XBM file on aFileName. |
127 "save image as XBM file on aFileName. |
128 This is obsolete - use the XBMReader directly." |
128 This is obsolete - use the XBMReader directly." |
129 |
129 |
130 (self class canRepresent:image) ifFalse:[ |
130 (self class canRepresent:image) ifFalse:[ |
131 self error:'can only save Depth1Images'. |
131 ^ Image cannotRepresentImageSignal |
132 ^ nil. |
132 raiseWith:image |
|
133 errorString:('ST80Form format only supports monochrome images'). |
|
134 ]. |
|
135 |
|
136 image mask notNil ifTrue:[ |
|
137 Image informationLostQuerySignal |
|
138 raiseWith:image |
|
139 errorString:('ST80Form format does not support an imageMask'). |
133 ]. |
140 ]. |
134 |
141 |
135 outStream := FileStream newFileNamed:aFileName. |
142 outStream := FileStream newFileNamed:aFileName. |
136 outStream isNil ifTrue:[ |
143 outStream isNil ifTrue:[ |
137 'create error' printNewline. |
144 ^ Image fileCreationErrorSignal |
138 ^ nil |
145 raiseWith:image |
|
146 errorString:('file creation error: ' , aFileName asString). |
139 ]. |
147 ]. |
140 |
148 |
141 width := image width. |
149 width := image width. |
142 height := image height. |
150 height := image height. |
143 photometric := image photometric. |
151 photometric := image photometric. |
154 outStream nextPutBytes:(data size) from:data. |
162 outStream nextPutBytes:(data size) from:data. |
155 |
163 |
156 outStream close |
164 outStream close |
157 |
165 |
158 "ST80FormReader save:(Image fromFile:'bitmaps/SBrowser.xbm') onFile:'test.form'" |
166 "ST80FormReader save:(Image fromFile:'bitmaps/SBrowser.xbm') onFile:'test.form'" |
|
167 |
|
168 "Modified: 27.2.1997 / 12:46:00 / cg" |
159 ! ! |
169 ! ! |
160 |
170 |
161 !ST80FormReader class methodsFor:'documentation'! |
171 !ST80FormReader class methodsFor:'documentation'! |
162 |
172 |
163 version |
173 version |
164 ^ '$Header: /cvs/stx/stx/libview2/ST80FormReader.st,v 1.16 1997-02-01 14:09:53 cg Exp $' |
174 ^ '$Header: /cvs/stx/stx/libview2/ST80FormReader.st,v 1.17 1997-02-27 11:50:58 cg Exp $' |
165 ! ! |
175 ! ! |
166 ST80FormReader initialize! |
176 ST80FormReader initialize! |