This is MiscGIFDecoder.h in view mode; [Download] [Up]
/* MiscGIFDecoder.h Copyright 1996 Netsurfer Inc. This notice may not be removed from this source code. The use and distribution of this software is governed by the terms of the MiscKit license agreement. Refer to the license document included with the MiscKit distribution for the terms. Author: <bbum@friday.com> Converted to OpenStep, September 1996, Uwe Hoffmann. */ #import <AppKit/AppKit.h> #import "MiscImageDecoder.h" #import "MiscGIFData.h" #define MISC_GCT_MAX_BYTES (256 * sizeof(MiscColorEntry32)) @interface MiscGIFDecoder:MiscImageDecoder { struct __GIFDecodeFlags { unsigned char showColorTable:1; /*"dump color table?"*/ /* if YES, the decoder will produce Silhouettes of the input gif-- that is, anywhere there is color in the original image, the result will be white. Likewise, anywhere there is transparency in the original image, the result will be transparent. Default is NO. */ unsigned char produceSilhouette:1;/*"produce silhouette?"*/ /* ++++++ Global Color Table FLAGS */ /* If YES, decoder will zero any bytes in GCT beyond last color of current image. */ unsigned char gctZeroUnused:1; /*"zero unspecified bytes?"*/ /* If YES, GIF stream has a global color table. */ unsigned char gctPresent:1;/*"gct present in stream?"*/ /* If YES, global color table is sorted in order of decreasing importance. */ unsigned char gctSorted:1;/*"gct sorted most to least significant?"*/ /* +++++ Graphical Control Extension FLAGS */ /* if YES, then a GCE was decoded immediately before what should be the next ImageDescriptor. The Graphic Control Extension should, therefore, modify the decoding of the Image Descriptor. If NO, then no GCE was present and the Image Descriptor should be decoded according to teh configuration found in the Logical Screen Descriptor, etc. */ unsigned char gcePresent:1;/*"graphic control extension?"*/ /* If YES, then gceTransparentColorIndex will contain the index of the color within the color table that should be rendered fully transparent. NOTE: this flag should NEVER be set if gcePresent is NOT ALSO SET-- the decoder does NOT check BOTH FLAGS! */ unsigned char gceUseTransparency:1;/*"image has transparency?"*/ /* +++++ Local Image Descriptor FLAGS */ /* If YES, indicates that a local color table has been allocated/read and should be used instead of the globalColorTable during decoding. */ unsigned char lctPresent:1;/*"local color table?"*/ /* If YES, the local color table is sorted in order of decreasing importance. */ unsigned char lctSorted:1;/*"local color table sorted?"*/ /* If YES, image descriptor is interlaced */ unsigned char idInterlaced:1;/*"interlaced iamge?"*/ } _SGIFDFlags; char version[4]; /*"GIF stream version; typically "87a" or "89a"."*/ /* Graphic Control Extension Information */ /* If _SGIFDFlags.gceUseTransparency is set [and _SGIFDFlags.gcePresent must be set, as well], then this instance variable will hold the index of the color within the local/global color table that should be rendered fully transparent. */ unsigned char gceTransparentColorIndex;/*"transparent color"*/ /* Logical Screen Descriptor */ unsigned short lsdWidth;/*"logical screen width"*/ unsigned short lsdHeight;/*"logical screen height"*/ unsigned char lsdColorResolution;/*"logical screen resolution"*/ unsigned short lsdGlobalColorTableSize;/*"ls table size"*/ unsigned char lsdBackgroundIndex;/*"ls background color index"*/ /* Global COLOR TABLE Always allocated to the maximum size [if an image is decoded that resuses a previous GCT, but the new image's GCT size is defined to be larger than the previous GCT, this prevents serious memory access errors-- but does not prevent the new image from decoding incorrectly. This is as the gif89a spec defines things to be. Unlike the gif spec, this color table is designed to contain 256 32 bit color entries-- that is 256 8 bit sample RGBA entries. */ unsigned char globalColorTable[MISC_GCT_MAX_BYTES]; /*"color table"*/ /* Image Descriptor Variables The following iVars are set and used during the image decoding process. They only remain valid through the decoding of a single <image descriptor>. There main purpose is to allow for the internal implementation to be broken up across multiple methods without requiring HUGE argument lists-- that and for abstract debugging purposes. See also the Image Descriptor FLAGS above */ /* Dimensions and Location of current image descriptor */ unsigned short idX;/*" local image descriptor X location "*/ unsigned short idY;/*" local image descriptor Y location "*/ unsigned short idWidth;/*" local image descriptor width "*/ unsigned short idHeight;/*" local image descriptor height "/ /* Size of and pointer to Local Color Table-- note: localColorTable will point to globalColorTable if there is no localColorTable present. */ unsigned char lctSize;/*" local color table size "*/ unsigned char *localColorTable;/*" local color table "*/ NSMutableArray *bitmaps; } - (BOOL)produceSilhouette; - (void)setProduceSilhouette:(BOOL)aFlag; - (BOOL)gctZeroUnused; - (void)setGctZeroUnused:(BOOL)aFlag; - (void)setShowColorTable:(BOOL)aFlag; - (BOOL)showColorTable; @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.