1 ////////////////////////////////////////////////////////////////////////////////
7 // Author: Daniel Switkin
9 // Copyright 2003 (c) by Daniel Switkin. This file is made publically available
10 // under the BSD license, with the stipulations that this complete header must
11 // remain at the top of the file indefinitely, and credit must be given to the
12 // original author in any about box using this software.
14 ////////////////////////////////////////////////////////////////////////////////
16 // Additional authors: John Scipione, <jscipione@gmail.com>
23 #include "LoadPalette.h"
26 #define GIF_INTERLACED 0x40
27 #define GIF_LOCALCOLORMAP 0x80
29 #define ENTRY_COUNT 4354
30 // 4354 = 4096 + 256 + 1 + 1
31 // 4096 for the image data, 256 for the color codes,
32 // 1 for the clear code, 1 for the end code
35 typedef struct Memblock
{
36 unsigned char data
[ENTRY_COUNT
];
42 const int gl_pass_starts_at
[] = { 0, 4, 2, 1, 0 };
43 const int gl_increment_pass_by
[] = { 8, 8, 4, 2, 0 };
48 GIFLoad(BPositionIO
* input
,
56 bool ReadGIFLoopBlock();
57 bool ReadGIFControlBlock();
58 bool ReadGIFImageHeader();
59 bool ReadGIFImageData();
60 bool ReadGIFCommentBlock();
61 bool ReadGIFUnknownBlock(unsigned char c
);
63 bool InitFrame(int codeSize
);
67 unsigned char* MemblockAllocate(int size
);
68 void MemblockDeleteAll();
70 inline bool OutputColor(unsigned char* string
, int size
);
74 LoadPalette
* fPalette
;
84 unsigned char fOldCode
[ENTRY_COUNT
];
85 unsigned int fOldCodeLength
;
96 unsigned char* fTable
[ENTRY_COUNT
];
97 short fEntrySize
[ENTRY_COUNT
];
98 Memblock
* fHeadMemblock
;
101 unsigned int fBitBuffer
;
102 unsigned char fByteCount
;
103 unsigned char fByteBuffer
[255];
106 int fScanlinePosition
;