To unload an image into a file, the unload:intoFileHandle:atOffset: message is sent to the appropriate CgImageFileFormat object. The method answers true if the image was successfully unloaded, or false if an error occurred. As with the load methods, the hasErrorOccurred, currentError, and currentErrorString methods can be used to handle errors.The following code unloads an image captured from the screen into a file named img-out.pcx using the PCX format:The unload:intoFile: method takes a file name as an argument. It creates the file if it does not exist, or overwrites the file if it does exist. The following code has the same effect as the previous example.
|