Copyright ã1995 by Netsurfer, Inc., All Rights Reserved.

Introduction

The SurfImage library implements a flexible object framework used to decode image files or streams into instances of NXImage.  Currently, SurfImage decodes GIF and JPEG/JFIF images.  The design of the framework is such that it is simple to add support for new image formats. 

To the incorporating application, all decoding and decoder management tasks are performed through a shared instance of the class SurfImageDecoder.  The shared instance of SurfImageDecoder maintains a database of decoders and the types those decoders can decode.

For example, the following code snippet will decode the JPEG/JFIF, GIF, or TIFF image contained in filePath into a newly allocated instance of NXImage.

id theNXImage = [[SurfImageDecoder sharedInstance] 	decodeFromFile:filePath];

In a single threaded environment, the incorporating application can ask the shared instance of SurfImageDecoder to decode an image that is contained in a file or NXStream.  The SurfImageDecoder will automatically determine which decoder can decode the image, decode the image using that decoder, and return an instance of NXImage encapsulating the decoded image.

In a multi-threaded environment, an application asks the SurfImageDecoder to return the class of decoder used to decode any particular image format.  Once the class has been determined, it is up to the application to allocate and manage the decoder object.  Since all decoders inherit from SurfDecoder, all decoders provide a concise API.

For decoding purposes, the Application does not need any awareness of the subclasses of SurfDecoder (currently SurfGIFDecoder and SurfJPEGDecoder).  The SurfImageDecoder shared instance acts as a Class Controller for the subclasses of SurfDecoder.  A Class Controller is just like a Class Cluster (see the foundation kit intro document for more information), but moves the control into an instance of some class instead of behind a set of class methods.

Adding new decoders

SurfImageDecoder allows the developer to add new or change the existing  image decoders.  To add or change a decoder, the developer first implements a subclass of SurfDecoder.  Upon application startup, the developer notifies SurfImageDecoder of the availability of the decoder by calling +addDecoderClass:.  

Sponsorship

NetImageFilter and SurfImage were developed by Bill Bumgarner <bbum@friday.com> with support from Netsurfer, Inc.  Both are unsupported products, but sending email to <bbum@friday.com> will likely result in a response or a new release.

Netsurfer, Inc has been kind enough to allow the author to distribute both SurfImage and NetImageFilter under the MiscKit License-- you are free to use the source and binaries for any purpose.  The author asks that you send email to <bbum@friday.com> before redistributing the code/binaries or before incorporating the code into existing projects;  it is not a requirement, but would be polite.

For their kindness, the author asks that you check out Netsurfer's most excellent internet resource browser!  Visit http://www.netsurfer.com or download a demo copy of Netsurfer.app from your nearest archive site (the latest version can always be found at ftp://ftp.thoughtport.com/pub/next/Netsurfer).  

As well, ThoughtPort Authority has kindly provided the author of these packages with the best internet connection the author has ever enjoyed using.  No downtime, no problems-- just good connectivity!  Please visit ThoughtPort and give them business so they continue to support these kinds of development efforts-- http://www.thoughtport.com.

It is likely that the latest information in regards to this and other software packages written or maintained by the author will be available within the friday.com domain.  Visit http://www.friday.com for more information.