7 ** $VER: classdata.h 2.3 (24.5.98)
8 ** gifanim.datatype 2.3
12 ** Written 1997/1998 by Roland 'Gizzy' Mainz
13 ** Original example source from David N. Junod
17 /*****************************************************************************/
19 /* public BOOPSI class name */
20 #define GIFANIMDTCLASS "gifanim.datatype"
22 /*****************************************************************************/
24 /* Use WPA8, but do only on demand */
27 /* Some CyberGFX configration stuff */
28 #define DIRECTRGB_DEPTH (16UL)
29 #define DIRECTRGB_PIXFMT (PIXFMT_RGB16)
31 /*****************************************************************************/
33 /* Maximum number of colors in a GIF picture */
34 #define MAXCOLORMAPSIZE (256)
36 #define MAX_LWZ_BITS (12)
38 /* size of a gif colormap entry (r, g. b)*/
39 #define GIFCMAPENTRYSIZE (3UL)
41 /* GIF flags and test macro */
42 #define SORTED (0x20) /* colors sorted, important first */
43 #define INTERLACE (0x40) /* interlaced picture */
44 #define LOCALCOLORMAP (0x80) /* frames have their own colormap */
45 #define BitSet( byte, bit ) (((byte) & (bit)) == (bit))
47 /*****************************************************************************/
49 /* macros to get rid of Intel 80x86 byte order */
50 #define LOHI2UINT16( a, b ) ((UWORD)(((b) << 8)|(a)))
52 #define SWAPW(a) ((WORD)(((UWORD)(a)>>8)+((((UWORD)(a)&0xff)<<8))))
53 #define SWAPUW(a) ((UWORD)(((UWORD)(a)>>8)+((((UWORD)(a)&0xff)<<8))))
54 #define SWAPL(a) ((LONG)(((ULONG)(a)>>24)+(((ULONG)(a)&0xff0000)>>8)+(((ULONG)(a)&0xff00)<<8)+(((ULONG)(a)&0xff)<<24)))
55 #define SWAPUL(a) ((ULONG)(((ULONG)(a)>>24)+(((ULONG)(a)&0xff0000)>>8)+(((ULONG)(a)&0xff00)<<8)+(((ULONG)(a)&0xff)<<24)))
57 /*****************************************************************************/
59 /* GIF decoder context data */
64 /* Read from file or pre-filled buffer (which merges multiple Read's to one Read */
65 #define WHICHFH_FILE (0)
66 #define WHICHFH_BUFFER (1)
68 UBYTE
*file_buffer
; /* buffer start */
69 UBYTE
*buffer
; /* current buffer pos */
70 ULONG buffersize
; /* buffer size */
76 struct ColorRegister ColorMap
[ MAXCOLORMAPSIZE
]; /* colormap */
77 UWORD BitPixel
; /* number of colors */
78 UWORD ColorResolution
;
80 UBYTE Background
; /* background pen */
86 UWORD transparent
; /* transparent pen; ~0U for nothing transparent */
87 UWORD delayTime
; /* frame delay in 1/100 sec */
88 BOOL inputFlag
; /* user input before continue ? */
90 #define GIF89A_DISPOSE_NOP (0U) /* No disposal specified. The decoder is not required to take any action. */
91 #define GIF89A_DISPOSE_NODISPOSE (1U) /* Do not dispose. The graphic is to be left in place. */
92 #define GIF89A_DISPOSE_RESTOREBACKGROUND (2U) /* Restore to background color. The area used by the graphic must be restored to the background color. */
93 #define GIF89A_DISPOSE_RESTOREPREVIOUS (3U) /* Restore to previous. The decoder is required to restore the area overwritten by the graphic with what was there prior to rendering the graphic. */
94 #define GIF89A_DISPOSE_RESERVED4 (4U) /* reserved */
95 #define GIF89A_DISPOSE_RESERVED5 (5U) /* reserved */
96 #define GIF89A_DISPOSE_RESERVED6 (6U) /* reserved */
97 #define GIF89A_DISPOSE_RESERVED7 (7U) /* reserved */
99 } Gif89
; /* = { (UWORD)~0U, (UWORD)~0U, FALSE, GIF89A_DISPOSE_NOP };*/
101 /* GetCode static vars */
111 BOOL ZeroDataBlock
; /* defaults to FALSE */
113 /* LWZReadByte static vars */
124 short table
[ 2 ][ (1 << MAX_LWZ_BITS
) ];
125 short stack
[ (1 << (MAX_LWZ_BITS
)) * 2 ],
127 BOOL fresh
/*= FALSE*/;
131 /*******************************************************************************/
133 /* gifanim.datatype class instance data */
134 struct GIFAnimInstData
137 struct SignalSemaphore gaid_SigSem
; /* Instance data lock */
144 struct BitMap
*gaid_KeyBitMap
; /* Key BitMap */
145 struct MinList gaid_FrameList
; /* List of frames */
146 STRPTR gaid_ProjectName
; /* Shortcut to DTA_Name */
147 BPTR gaid_VerboseOutput
; /* Verbose output. -1 means: Avoid any output (NOVERBOSE option) */
151 BOOL gaid_LoadAll
; /* Load all frames of the animation */
152 BOOL gaid_FPS
; /* fps of stream (maybe modified by prefs) */
153 BOOL gaid_UseChunkyMap
;
154 BOOL gaid_StrictSyntax
;
158 ULONG gaid_SampleLength
;
161 ULONG gaid_SamplesPerFrame
;
163 /* Disk-loading section */
165 LONG gaid_CurrFilePos
;
167 /* decoder specific data */
168 struct GIFDecoder gaid_GIFDec
;
172 /* node which holds information about a single animation frame */
175 struct MinNode fn_Node
;
186 /* Bitmap/ColorMap section */
187 struct BitMap
*fn_BitMap
;
188 struct ColorMap
*fn_CMap
;
190 UBYTE
*fn_ChunkyMap
; /* bitmap data in chunky version */
191 struct ColorRegister fn_ColorMap
[ MAXCOLORMAPSIZE
]; /* colormap, used for 24 bit output */
194 /* BitMap loading section */
195 LONG fn_BMOffset
; /* File offset (0 is begin of file) */
196 ULONG fn_BMSize
; /* Chunk size */
198 /* GIF89a specific */
199 UWORD fn_GIF89aDisposal
; /* GIF 89a extension disposal mode */
200 UWORD fn_GIF89aTransparent
;
204 ULONG fn_SampleLength
;
208 /*******************************************************************************/
210 #endif /* !CLASSDATA_H */