8#define ARGS(alist) alist
18#define put_byte(A) (*put_b)((byte)(A)); Nbyte++
63long GIFencode(
int Width,
int Height,
int Ncol,
byte R[],
byte G[],
byte B[],
byte ScLine[],
64 void(*get_scline)
ARGS((
int,
int,
byte *)),
void(*pb)
ARGS((
byte)))
67 int ncol, i,
x,
y, disp, Code, K;
72 if (Width <= 0 || Width > 4096 || Height <= 0 || Height > 4096) {
74 "\nGIFencode: incorrect image size: %d x %d\n", Width, Height);
78 if (Ncol <= 0 || Ncol > 256) {
79 fprintf(stderr,
"\nGIFencode: wrong number of colors: %d\n", Ncol);
124 for (i=0; i<Ncol; i++) {
129 for (; i<ncol; i++) {
151 for (
y=0;
y<Height;
y++) {
152 (*get_scline)(
y, Width, ScLine);
158 CodeK = ((long) K <<
BITS) + Code;
159 i = (K <<
SHIFT) ^ Code;
169 if (i == 0) disp = 1;
209static unsigned long masks[] = { 0x0000,
210 0x0001, 0x0003, 0x0007, 0x000F,
211 0x001F, 0x003F, 0x007F, 0x00FF,
212 0x01FF, 0x03FF, 0x07FF, 0x0FFF,
213 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF };
static unsigned long masks[]
static unsigned long cur_accum
static long HashTab[5003]
long GIFencode(int Width, int Height, int Ncol, R, G, B, ScLine, void *get_scline, pb)