To load an image from a file, the loadFromFileHandle:atOffset: message is sent to an instance of the appropriate subclass of CgImageFileFormat. The first argument is a CfsFileDescriptor, opened for reading on the input file. The atOffset: argument is the number of bytes from the start of the file at which to start reading. The result is a CgDeviceIndependentImage if the file was successfully loaded, or nil if an error occurred.The loadFromFile: method takes a file name directly, saving the application from having to explicitly open and close the file. The following code has the same result as the previous example:
|