This is SurfDecoder.rtf in view mode; [Download] [Up]
paperh18648 margl-907 margr0 margt0 margb0fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1995 by Netsurfer, Inc., All Rights Reserved. pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 fs16 fs28 fs16 fs28 pard s5 li2116 fi0 ri1007 ql f0 b fs56 SurfDecoder fs16 fs56 pard s17 li4888 fi-2771 ri1007 ql tx4888 f1 b0 fs28 fs16 fs28 f0 b fs28 Inherits From: b0 fs28 f1 Object fs16 s10 fs16 fs28 f0 b fs28 Declared In: b0 fs28 f1 SurfDecoder fs16 fs28 pard s13 li1360 fi0 ri1007 ql f0 b fs36 fs16 fs36 Class Description fs16 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs28 fs16 fs28 This class is an abstract superclass for all image decoders. An image decoder need only implement those methods marked as the responsibility of the subclass. fs28s13 li1360 fi0 ri1007 ql f0 b fs36 fs16 fs36 Instance Variables fs16 pard s18 li2116 fi0 ri1007 ql tx2872 f1 b0 fs28 unsigned char b verboseMode:1b0 ; unsigned char b lastCorrupt:1b0 ; id b returnImageb0 ; NXWindowDepth b imageDepthb0 ; id <SurfErrorDelegate> b errorDelegateb0 ; pard s11 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 fs28 verboseMode:1 YES if verbosity enabled fs16 fs28 lastCorrupt:1 YES if last image corrupt fs16 fs28 returnImage image eventually returned to caller fs16 fs28 imageDepth target decoding depth fs16 fs28 errorDelegate Error Delegate pard s13 li1360 fi0 ri1007 ql f0 b fs36 fs16 fs36 Method Types fs16 f1 b0 fs28 s35 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 fs28 Shared Instance + sharedInstance pard s35 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 fs28 Filterable Type Query + imageUnfilteredFileTypes pard s34 li6652 fi-503 ri1007 ql tx9676 tx10180 + canLoadFromStream: pard s35 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 fs28 Designated Initializer {f3 -} init pard s35 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 fs28 Decoding an Image {f3 -} _decodeFromStream: pard s34 li6652 fi-503 ri1007 ql tx9676 tx10180 {f3 -} decodeFromFile: {f3 -} decodeFromFile:intoImage: {f3 -} decodeFromStream: {f3 -} decodeFromStream:intoImage: pard s35 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 fs28 Set / Query {f3 -} setImageDepth: pard s34 li6652 fi-503 ri1007 ql tx9676 tx10180 {f3 -} imageDepth {f3 -} setLastImageCorrupt: {f3 -} lastImageCorrupt {f3 -} verboseMode {f3 -} setVerboseMode: {f3 -} setErrorDelegate: {f3 -} errorDelegate pard s35 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 fs28 Error Handling {f3 -} spewMessage:withSeverity: pard s13 li1360 fi0 ri1007 ql f0 b fs36 fs16 fs36 Class Methods fs16 fs36 s21 li2493 fi-1132 fi-376 fs28 fs16 fs29 b canLoadFromStream: s20 li3249 fi-1132 fi-756 f1 b0 fs28 + (BOOL)b canLoadFromStream:b0 (NXStream *)i streami0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Returns YES if an instance of the decoder class can decode the iamge contained in i streami0 . An implementation of this method should read the minnimum number of bytes necessary to determine if it can decode the i streami0 . The seek position in the i streami0 must be preserved. i It is the responsibility of the subclass to implement this method!i0 fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b imageUnfilteredFileTypes s20 li3249 fi-1132 fi-756 f1 b0 fs28 + (const char *const *)b imageUnfilteredFileTypesb0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Returns a b NULLb0 terminated array of types (file extensions) that an instance of the decoder class can filter to TIFF. i It is the responsibility of the subclass to implement this method!i0 fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b sharedInstance s20 li3249 fi-1132 fi-756 f1 b0 fs28 + b sharedInstanceb0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Returns an instance that can be shared throughout the application. i It is the responsibility of the subclass to implement this method!i0 pard s13 li1360 fi0 ri1007 ql f0 b fs36 fs16 fs36 Instance Methods fs16 fs36 s21 li2493 fi-1132 fi-376 fs28 fs16 fs29 b _decodeFromStream: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} b _decodeFromStream:b0 (NXStream *)i theStreami0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 This is the method that actually performs the decoding. This method should never be called directly. fs16 fs28 fs16 fs28 Upon entry, i theStreami0 has already been validated as a stream that contains an image that the image decoder can [potentially] decode. The decoder should decode the image into an instance of some subclass of NXImageRep that is stored in the b returnImageb0 by using the b -useRepresentation:b0 method. fs16 fs28 fs16 fs28 i It is the responsibility of the subclass to implement this method!i0 fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b decodeFromFile: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} b decodeFromFile:b0 (const char *)i filePathi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Decode image contained in i filePathi0 . Returns an instance of NXImage containing the image data. It is the caller's responsibility to dispose of the iamge object. Returns b nilb0 if unable to decode i filePathi0 . Note that this method may return an image if i filePathi0 is corrupt. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b decodeFromFile:intoImage: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} b decodeFromFile:b0 (const char *)i filePathi0 b intoImage:b0 i imagei0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Decode i imagei0 contained in i filePathi0 into i imagei0 . Image should be an instance of NXImage. If iamge is undefined, an instance of NXImage will be allocated. It is the caller's responsibility to dispose of the iamge object. Returns b nilb0 if unable to decode i filePathi0 . Note that this method may return an i imagei0 if i filePathi0 is corrupt. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b decodeFromStream: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} b decodeFromStream:b0 (NXStream *)i streami0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Decode image contained in i streami0 . Same behaviour as b -decodeFromFile:b0 fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b decodeFromStream:intoImage: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} b decodeFromStream:b0 (NXStream *)i streami0 b intoImage:b0 i imagei0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Decode i imagei0 contained in i streami0 . Same behaviour as b -decodeFromFile:intoImage:b0 fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b errorDelegate s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} b errorDelegateb0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 returns the error delegate. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b imageDepth s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (NXWindowDepth)b imageDepthb0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Returns the target decoding depth. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b init s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} b initb0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Designated initializer. Disables verbose mode. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b lastImageCorrupt s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (BOOL)b lastImageCorruptb0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Returns YES if the last image decoded was corrupt. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b setErrorDelegate: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b setErrorDelegate:b0 (id <SurfErrorDelegate>)i aDelegatei0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Sets the error delegate to i aDelegatei0 . i aDelegatei0 will receive notification whenever the decoder generates an error message. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b setImageDepth: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b setImageDepth:b0 (NXWindowDepth)i aDepthi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Sets the decoding depth (i imageDepthi0 ) to i aDepthi0 . The decoder can use i imageDepthi0 to optimize the decoding process to the particular display device. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b setLastImageCorrupt: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b setLastImageCorrupt:b0 (BOOL)i aFlagi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 This method should i onlyi0 be called by the decoder. If is used to mark the last decoded image as being corrupt. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b setVerboseMode: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b setVerboseMode:b0 (BOOL)i aFlagi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Enables / disables verbose mode. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b spewMessage:withSeverity: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b spewMessage:b0 (const char *)i errMsgi0 b withSeverity:b0 (SurfErrorSeverity)i aSeverityi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 This method should not be overridden. It should be invoked whenever the decoder wishes to spew a message. The message will be passed to the errorDelegate via the b -decoder:spewMessage:withSeverity:b0 method in the b SurfErrorDelegateb0 protocol. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b verboseMode s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (BOOL)b verboseModeb0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Returns YES if verbose mode is enabled. If verbose mode is enabled, the image decoder should dump notes about the decoding process. For example, the GIF decoder dumps information about each step of the decoding process. Useful for debugging purposes. }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.