00001 00008 #include "DLLogger.h" 00009 #include "DLException.h" 00010 00013 00014 struct DL_LZW_table { 00016 int count; 00018 unsigned char *out; 00019 }; 00020 00024 struct DLGifImageFormat { 00026 void *image; 00038 int type; 00042 int byte_order; 00043 00051 int compression; 00052 00054 int width; 00055 00057 int height; 00058 00062 int numchan; 00067 int numframes; 00072 int bits_per_chan; 00076 int packed; 00085 int photoInterpretation; 00089 int unit_resolution; 00091 int xresolution; 00093 int yresolution; 00094 00102 int *chan_ratio; 00104 char *desc; 00106 char filetype[5]; 00108 void *user_def0; 00110 int user_def1; 00122 struct DLGifImageFormat *palette; 00123 }; 00124 00125 00126 00130 class DLGIFUtilities 00131 { 00132 public: 00133 00142 static int image_paste_transparent (struct DLGifImageFormat *image_overlay, 00143 struct DLGifImageFormat **image_out, 00144 int *origin, unsigned char transparent); 00152 static int image_read_gif(const unsigned char *buffer, int buffSize, struct DLGifImageFormat **image_in); 00160 static int image_paste (struct DLGifImageFormat *image_overlay, struct DLGifImageFormat **image_out, int *origin); 00168 static int image_GIF_realign (struct DLGifImageFormat *fimage, int *error_locs, int num_fragments); 00174 static int image_GIF_deinterlace (struct DLGifImageFormat *fimage); 00184 static int buffer_find_next_clear_code_new (unsigned char *inbuf, int numbytes,int codesize, int *bytepos, int *bitpos); 00193 static int buffer_resync_gif_block (unsigned char *buf, int offset, int bufsize, int key); 00202 static int buffer_find_far_processed (unsigned char *fbuf, int findx, int fmax, int eindx); 00216 static int buffer_LZW_decode_new (unsigned char *inbuf, int byte_offset, 00217 int bit_offset,int numbytes, 00218 int start_codesize, struct DLGifImageFormat *fimage, 00219 int *pixloc, int *eoi_flag, int *retVal); 00230 static int buffer_parse_gif_block_new (unsigned char *buf, int bufindx, 00231 int bufsize, unsigned char *obuf, 00232 int *numread, int *key); 00239 static unsigned char palette_adjust_transparent (struct DLGifImageFormat *palette, 00240 unsigned char transparent_value); 00249 static int initialize_LZW_table(struct DL_LZW_table *table, int size, unsigned char *tbuf, int *tindx); 00259 static int getnextcode(int *buffer, int *indx, int codesize, unsigned char *inbuf, int *bufindx); 00268 static int image_create (struct DLGifImageFormat **image_out, int *size, int numchan, int type); 00275 static int image_copy (struct DLGifImageFormat *image_in, struct DLGifImageFormat **image_out); 00276 }; 00277