Last updated at 8:22 pm UTC on 11 November 2017
The instance method #saveOnFile is implemented in class Morphic and allows any instance of Morph or a subclass to be saved in a file together with its submorphs.
The file extension is '.morph'.
Such a file may be dropped onto the desktop of a target image and will be reloaded there.
The method uses a SmartRefStream to do the serialization.
"Save myself on a SmartReferenceStream file. Writes out the version and class structure.
The file is fileIn-able. UniClasses will be filed out."
| fileStream |
fileStream := FileStream newFileNamed: filenameString asFileName.
fileStream fileOutClass: nil andObject: self. "Puts UniClass definitions out anyway, and closes the stream."