ftp.nice.ch/pub/next/developer/resources/libraries/SurfImage.1.0.NIHS.b.tar.gz#/SurfImage/Documentation/Classes/SurfGIFDecoder.rtf

This is SurfGIFDecoder.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 SurfGIFDecoder 
fs16 





fs56 pard s17 li4888 fi-2771 ri1007 ql tx4888 f1 b0 fs28 fs16 fs28 f0 b fs28 Inherits From:	b0 fs28 f1 SurfDecoder
fs16 s10 fs16 fs28 f0 b fs28 Declared In:	b0 fs28 f1 SurfGIFSupport.subproj/SurfGIFDecoder
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 encapsulates all state necessary to decode a particular GIF stream into an instance of NXImage.  The instance of NXImage may contain multiple NXBitmapImageReps-- each one containing one of the images decoded from the GIF stream.  This level of abstraction [a class encapsulating the decoder] is necessary to fully support the features of GIF in a manner compatible with NXImage and also support the move to a threaded environment.
fs16 
fs28 fs16 fs28 The GIF specification defines more than an image encapsulation schema; the decoder must be able to "remember" some state between decoding images.  For example, a valid GIF stream is one that contains nothing but a Global Color Table -- as well, a valid GIF stream is one that doesn't contain any Color Tables at all; when encountered, it effectively inherits the color table used to decode the last image [hence the usefulness of a stream that is nothing but a color table].
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 showColorTable:1b0 ;
unsigned char b produceSilhouette:1b0 ;
unsigned char b gctZeroUnused:1b0 ;
unsigned char b gctPresent:1b0 ;
unsigned char b gctSorted:1b0 ;
unsigned char b gcePresent:1b0 ;
unsigned char b gceUseTransparency:1b0 ;
unsigned char b lctPresent:1b0 ;
unsigned char b lctSorted:1b0 ;
unsigned char b idInterlaced:1b0 ;
char b version[4]b0 ;
unsigned char b gceTransparentColorIndexb0 ;
unsigned short b lsdWidthb0 ;
unsigned short b lsdHeightb0 ;
unsigned char b lsdColorResolutionb0 ;
unsigned short b lsdGlobalColorTableSizeb0 ;
unsigned char b lsdBackgroundIndexb0 ;
unsigned char b globalColorTable[GCT_MAX_BYTES]b0 ;
unsigned short b idXb0 ;
unsigned short b idYb0 ;
unsigned short b idWidthb0 ;
unsigned short b idHeightb0 ;
unsigned char *b localColorTableb0 ;
LWZState *b decompressionStateb0 ;
pard s11 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 


fs28 showColorTable:1 	dump color table?
fs16 
fs28 produceSilhouette:1 	produce silhouette?
fs16 
fs28 gctZeroUnused:1 	zero unspecified bytes?
fs16 
fs28 gctPresent:1 	gct present in stream?
fs16 
fs28 gctSorted:1 	gct sorted most to least significant?
fs16 
fs28 gcePresent:1 	graphic control extension?
fs16 
fs28 gceUseTransparency:1 	image has transparency?
fs16 
fs28 lctPresent:1 	local color table?
fs16 
fs28 lctSorted:1 	local color table sorted?
fs16 
fs28 idInterlaced:1 	interlaced iamge?
fs16 
fs28 version[4] 	GIF stream version; typically "87a" or "89a".
fs16 
fs28 gceTransparentColorIndex 	transparent color
fs16 
fs28 lsdWidth 	logical screen width
fs16 
fs28 lsdHeight 	logical screen height
fs16 
fs28 lsdColorResolution 	logical screen resolution
fs16 
fs28 lsdGlobalColorTableSize 	ls table size
fs16 
fs28 lsdBackgroundIndex 	ls background color index
fs16 
fs28 globalColorTable[GCT_MAX_BYTES] 	color table
fs16 
fs28 idX 	local image descriptor X location
fs16 
fs28 idY 	local image descriptor Y location
fs16 
fs28 idWidth 	local image descriptor width
fs16 
fs28 idHeight 	local image descriptor height "/ unsigned char lctSize;/*" local color table size
fs16 
fs28 localColorTable 	local color table
fs16 
fs28 decompressionState 	LWZ decompression engine
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 Instantiation 	+ sharedInstance
pard s35 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 
fs28 Class query 	+ imageUnfilteredFileTypes
pard s34 li6652 fi-503 ri1007 ql tx9676 tx10180 + canLoadFromStream:
pard s35 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 
fs28 Custom GIF Features 	{f3 -} produceSilhouette
pard s34 li6652 fi-503 ri1007 ql tx9676 tx10180 {f3 -} setProduceSilhouette:
{f3 -} gctZeroUnused
{f3 -} setGctZeroUnused:
{f3 -} setShowColorTable:
{f3 -} showColorTable
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 the first few bytes of i streami0  indicate an image that an instance of this decoder can likely decode successfully. 
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 file extensions that this decoder class can decode. 
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 This method is provided for convenience and should only be used in a single-threaded conversion environment.  In a multiple threaded environment, it is much safer to not use this method and to manage the multiple iinstances using the normal alloc/init/free paradigm. 
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 gctZeroUnused
s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (BOOL)b  gctZeroUnusedb0 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 
fs28 Returns YES if the decoder will zero all unused global color table entries beyond the last entry for the current image.  Basically, this ensures that if the image references an entry in the color table beyond the color table size (since the global color table is large enough to hold the maximum sized color table, overrunning the current global color table size CANOT cause a memory exception), the resulting pixel will be black. 
fs16 
fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 


fs29 b produceSilhouette
s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (BOOL)b  produceSilhouetteb0 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 
fs28 Returns YES if decoder will produce a silhouette of the image.  A silhuette is transparent wherever the gif is transparent and is solid white wherever the image is non-transparent. 
fs16 
fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 


fs29 b setGctZeroUnused:
s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b  setGctZeroUnused:b0 (BOOL)i aFlagi0 b b0 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 
fs28 Enables/disables zeroing of unused global color table entries.
fs16 
fs28 fs16 fs28 see b -gctZeroUnusedb0 . 
fs16 
fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 


fs29 b setProduceSilhouette:
s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b  setProduceSilhouette:b0 (BOOL)i aFlagi0 b b0 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 
fs28 Enables/disables silhouette mode.
fs16 
fs28 fs16 fs28 see b -produceSilhouetteb0 . 
fs16 
fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 


fs29 b setShowColorTable:
s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b  setShowColorTable:b0 (BOOL)i aFlagi0 b b0 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 
fs28 If enabled, each color table will be printed in ASCII form to stderr. 
fs16 
fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 


fs29 b showColorTable
s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (BOOL)b  showColorTableb0 
pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 
fs28 Returns YES if each decoded color table is printed to stderr. 
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.