27 #ifndef __SYNFIG_TRGT_GIF_H
28 #define __SYNFIG_TRGT_GIF_H
57 bitstream():pool(0),curr_bit(0),curr_pos(0) {}
59 unsigned char buffer[256];
63 void push_bit(
bool bit)
66 pool|=(1<<(curr_bit));
77 buffer[curr_pos++]=pool;
80 if(curr_pos==255)dump();
91 if(curr_pos || curr_bit)
93 fputc(curr_pos,file.get());
94 fwrite(buffer,curr_pos,1,file.get());
101 void push_value(
int value,
int size)
105 push_bit((value>>(i))&1);
114 struct lzwcode* kids;
115 struct lzwcode* next;
117 lzwcode():value(0),code(0),kids(0),next(0) { }
119 lzwcode *FindCode(
int value)
124 for (node = node->kids; node != 0; node = node->next)
125 if (node->value == value)
130 void AddNode(
unsigned short code,
unsigned short value)
132 lzwcode *n =
new lzwcode;
138 n->next = this->kids;
142 static lzwcode * NewTable(
int values)
145 lzwcode * table =
new lzwcode;
148 for (i = 0; i < values; i++)
149 table->AddNode( i, i);
174 lzwcode *table,*next,*node;
177 etl::surface<unsigned char> curr_frame;
178 etl::surface<unsigned char> prev_frame;
195 void output_curr_palette();