Import the current wip animation datatype and subclasses. further development will...
[AROS.git] / workbench / classes / datatypes / gifanim / classdata.h
bloba16b630c31ea4a5dd34043f9c02daf9d387fb30f
2 #ifndef CLASSDATA_H
3 #define CLASSDATA_H 1
5 /*
6 **
7 ** $VER: classdata.h 2.3 (24.5.98)
8 ** gifanim.datatype 2.3
9 **
10 ** gifanim class data
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 */
25 #define DELTAWPA8 1
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 */
60 struct GIFDecoder
62 BOOL which_fh;
63 BOOL pad0;
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)
67 BPTR file;
68 UBYTE *file_buffer; /* buffer start */
69 UBYTE *buffer; /* current buffer pos */
70 ULONG buffersize; /* buffer size */
72 struct
74 UWORD Width;
75 UWORD Height;
76 struct ColorRegister ColorMap[ MAXCOLORMAPSIZE ]; /* colormap */
77 UWORD BitPixel; /* number of colors */
78 UWORD ColorResolution;
79 UWORD AspectRatio;
80 UBYTE Background; /* background pen */
81 UBYTE Pad1;
82 } GifScreen;
84 struct
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 ? */
89 UBYTE disposal;
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 */
98 UBYTE Pad2;
99 } Gif89; /* = { (UWORD)~0U, (UWORD)~0U, FALSE, GIF89A_DISPOSE_NOP };*/
101 /* GetCode static vars */
102 struct
104 UBYTE buf[ 280 ];
105 int curbit,
106 lastbit,
107 last_byte;
108 BOOL done;
109 } GetCode;
111 BOOL ZeroDataBlock; /* defaults to FALSE */
113 /* LWZReadByte static vars */
114 struct
116 int code_size,
117 set_code_size;
118 int max_code,
119 max_code_size;
120 int firstcode,
121 oldcode;
122 int clear_code,
123 end_code;
124 short table[ 2 ][ (1 << MAX_LWZ_BITS) ];
125 short stack[ (1 << (MAX_LWZ_BITS)) * 2 ],
126 *sp;
127 BOOL fresh /*= FALSE*/;
128 } LWZReadByte;
131 /*******************************************************************************/
133 /* gifanim.datatype class instance data */
134 struct GIFAnimInstData
136 /* Misc */
137 struct SignalSemaphore gaid_SigSem; /* Instance data lock */
138 UWORD gaid_Pad0;
139 APTR gaid_Pool;
140 UWORD gaid_Width,
141 gaid_PaddedWidth,
142 gaid_Height,
143 gaid_Depth;
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) */
149 /* Prefs */
150 IPTR gaid_ModeID;
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;
156 /* Sample stuff */
157 BYTE *gaid_Sample;
158 ULONG gaid_SampleLength;
159 ULONG gaid_Period;
160 ULONG gaid_Volume;
161 ULONG gaid_SamplesPerFrame;
163 /* Disk-loading section */
164 BPTR gaid_FH;
165 LONG gaid_CurrFilePos;
167 /* decoder specific data */
168 struct GIFDecoder gaid_GIFDec;
172 /* node which holds information about a single animation frame */
173 struct FrameNode
175 struct MinNode fn_Node;
177 /* Misc */
178 WORD fn_UseCount;
179 UWORD fn_Pad0;
181 /* Timing section */
182 ULONG fn_TimeStamp;
183 ULONG fn_Frame;
184 ULONG fn_Duration;
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;
202 /* Sample section */
203 BYTE *fn_Sample;
204 ULONG fn_SampleLength;
205 ULONG fn_Period;
208 /*******************************************************************************/
210 #endif /* !CLASSDATA_H */