Doxygen Source Code Documentation
gif.h File Reference
#include <stdio.h>
#include <stdlib.h>
Go to the source code of this file.
Define Documentation
|
Definition at line 183 of file gif.h. Referenced by color_change_transformer(), colormap_combine(), ensure_slot_255(), find_background(), find_color_index(), Gif_AddColor(), Gif_ColorEq(), Gif_FindColor(), merge_colormap_if_possible(), and try_assign_transparency(). |
|
|
|
Definition at line 271 of file gif.h. Referenced by read_color_table(), read_gif(), read_image(), read_image_block(), read_image_data(), real_write_image_data(), and write_compressed_data(). |
|
Definition at line 294 of file gif.h. Referenced by blank_frameset(), create_x_colormap_extension(), delete_color_transforms(), delete_opt_data(), delete_viewer(), delete_xcolormap(), explode_filename(), Gif_DeleteColormap(), Gif_DeleteComment(), Gif_DeleteExtension(), Gif_DeleteImage(), Gif_DeleteStream(), Gif_DeleteXContext(), Gif_NewFullColormap(), and Gif_RemoveDeletionHook(). |
|
|
Definition at line 291 of file gif.h. Referenced by colormap_stream(), copy_extension(), create_new_image_data(), Gif_CopyImage(), Gif_CreateUncompressedImage(), Gif_FullCompressImage(), Gif_NewImage(), read_compressed_image(), rotate_image(), scale_image(), and unoptimize_image(). |
|
|
|
Definition at line 116 of file gif.h. Referenced by apply_frame_disposal(), create_new_image_data(), create_subimages(), finalize_optimizer(), find_difference_bounds(), and main(). |
|
Definition at line 117 of file gif.h. Referenced by apply_frame_disposal(), apply_image_disposal(), create_new_image_data(), create_subimages(), find_background(), Gif_XNextImage(), histogram(), main(), and unoptimize_image(). |
|
Definition at line 115 of file gif.h. Referenced by apply_frame_disposal(), create_new_image_data(), finalize_optimizer(), find_difference_bounds(), Gif_NewImage(), and main(). |
|
Definition at line 118 of file gif.h. Referenced by apply_image(), apply_image_disposal(), create_new_image_data(), create_subimages(), Gif_XNextImage(), unoptimize_image(), and unoptimized_frame(). |
|
Definition at line 76 of file gif.h. Referenced by get_input_stream(), input_stream(), input_stream_done(), new_viewer(), parse_frame_spec(), and view_frame(). |
|
|
|
Definition at line 132 of file gif.h. Referenced by view_frame(). |
|
|
|
Definition at line 131 of file gif.h. Referenced by view_frame(). |
|
|
|
Definition at line 277 of file gif.h. Referenced by read_application_extension(), read_graphic_control_extension(), read_image(), read_image_data(), and read_unknown_extension(). |
|
Definition at line 276 of file gif.h. Referenced by Gif_FullCompressImage(), Gif_FullUncompressImage(), read_gif(), and write_gif(). |
|
Definition at line 275 of file gif.h. Referenced by read_image_data(), real_write_image_data(), and write_compressed_data(). |
|
|
|
Definition at line 285 of file gif.h. Referenced by append_color_change(), append_color_transform(), create_x_colormap_extension(), Gif_AddDeletionHook(), Gif_NewColormap(), Gif_NewComment(), Gif_NewExtension(), Gif_NewFullColormap(), Gif_NewImage(), Gif_NewStream(), Gif_NewXContextFromVisual(), main(), new_frameset(), new_opt_data(), and new_viewer(). |
|
|
Definition at line 235 of file gif.h. Referenced by get_input_stream(), Gif_FullReadRecord(), input_stream(), main(), and read_image(). |
|
Definition at line 237 of file gif.h. Referenced by Gif_FullReadRecord(), and read_compressed_image(). |
|
Definition at line 236 of file gif.h. Referenced by Gif_ReadFile(), Gif_ReadRecord(), and read_image(). |
|
Definition at line 249 of file gif.h. Referenced by read_colormap_file(). |
|
|
|
Definition at line 287 of file gif.h. Referenced by add_frame(), colormap_combine(), create_image_data(), Gif_AddColor(), Gif_AddCommentTake(), Gif_AddImage(), memory_block_putter(), memory_byte_putter(), merger_add(), read_compressed_image(), read_unknown_extension(), and suck_data(). |
|
|
|
|
|
|
|
Definition at line 262 of file gif.h. Referenced by Gif_DeleteColormap(), Gif_DeleteXContext(), and Gif_NewXContextFromVisual(). |
|
Definition at line 261 of file gif.h. Referenced by Gif_DeleteImage(). |
|
Definition at line 260 of file gif.h. Referenced by Gif_DeleteStream(). |
|
Definition at line 139 of file gif.h. Referenced by apply_image(), calculate_min_code_bits(), create_subimages(), Gif_XSubMask(), merge_frame_interval(), put_sub_image_colormap(), and unoptimize_image(). |
|
|
|
Definition at line 238 of file gif.h. Referenced by calculate_min_code_bits(), get_color_table_size(), and main(). |
|
|
|
|
|
|
|
|
Typedef Documentation
|
|
|
Definition at line 274 of file gif.h. Referenced by change_node_to_table(), Gif_FullCompressImage(), Gif_FullUncompressImage(), one_code(), read_gif(), read_image_data(), real_write_image_data(), write_compressed_data(), and write_gif(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 137 of file gif.h. Referenced by Gif_FullReadFile(), Gif_FullReadRecord(), Gif_FullUncompressImage(), and read_gif(). |
|
|
|
|
Function Documentation
|
Definition at line 562 of file giffunc.c. References c, Gif_Colormap::capacity, Gif_Colormap::col, GIF_COLOREQ, Gif_ReArray, i, and Gif_Colormap::ncol. Referenced by combine_colormaps().
00563 { 00564 int i; 00565 if (look_from >= 0) 00566 for (i = look_from; i < gfcm->ncol; i++) 00567 if (GIF_COLOREQ(&gfcm->col[i], c)) 00568 return i; 00569 if (gfcm->ncol >= gfcm->capacity) { 00570 gfcm->capacity *= 2; 00571 Gif_ReArray(gfcm->col, Gif_Color, gfcm->capacity); 00572 if (gfcm->col == 0) return -1; 00573 } 00574 i = gfcm->ncol; 00575 gfcm->ncol++; 00576 gfcm->col[i] = *c; 00577 return i; 00578 } |
|
Definition at line 198 of file giffunc.c. References Gif_AddCommentTake(), Gif_DeleteArray, and Gif_NewArray. Referenced by Gif_CopyImage(), main(), and merge_comments().
00199 { 00200 char *new_x; 00201 if (xlen < 0) xlen = strlen(x); 00202 new_x = Gif_NewArray(char, xlen); 00203 if (!new_x) return 0; 00204 memcpy(new_x, x, xlen); 00205 if (Gif_AddCommentTake(gfcom, new_x, xlen) == 0) { 00206 Gif_DeleteArray(new_x); 00207 return 0; 00208 } else 00209 return 1; 00210 } |
|
Definition at line 180 of file giffunc.c. References Gif_Comment::cap, Gif_Comment::count, Gif_ReArray, Gif_Comment::len, and Gif_Comment::str. Referenced by Gif_AddComment(), and read_comment_extension().
00181 { 00182 if (gfcom->count >= gfcom->cap) { 00183 if (gfcom->cap) gfcom->cap *= 2; 00184 else gfcom->cap = 2; 00185 Gif_ReArray(gfcom->str, char *, gfcom->cap); 00186 Gif_ReArray(gfcom->len, int, gfcom->cap); 00187 if (!gfcom->str || !gfcom->len) return 0; 00188 } 00189 if (xlen < 0) xlen = strlen(x); 00190 gfcom->str[ gfcom->count ] = x; 00191 gfcom->len[ gfcom->count ] = xlen; 00192 gfcom->count++; 00193 return 1; 00194 } |
|
|
|
Definition at line 214 of file giffunc.c. References Gif_Stream::extensions, Gif_Extension::next, Gif_Extension::position, and Gif_Extension::stream. Referenced by merge_frame_interval(), and read_unknown_extension().
00215 { 00216 Gif_Extension *prev, *trav; 00217 if (gfex->stream) return 0; 00218 for (prev = 0, trav = gfs->extensions; 00219 trav && trav->position <= pos; 00220 prev = trav, trav = trav->next) 00221 ; 00222 if (prev) prev->next = gfex; 00223 else gfs->extensions = gfex; 00224 gfex->next = trav; 00225 return 1; 00226 } |
|
Definition at line 151 of file giffunc.c. References Gif_ReArray, Gif_Stream::images, Gif_Stream::imagescap, Gif_Stream::nimages, and Gif_Image::refcount. Referenced by Gif_CopyStreamImages(), merge_image(), and read_gif().
00152 { 00153 if (gfs->nimages >= gfs->imagescap) { 00154 if (gfs->imagescap) gfs->imagescap *= 2; 00155 else gfs->imagescap = 2; 00156 Gif_ReArray(gfs->images, Gif_Image *, gfs->imagescap); 00157 if (!gfs->images) return 0; 00158 } 00159 gfs->images[gfs->nimages] = gfi; 00160 gfs->nimages++; 00161 gfi->refcount++; 00162 return 1; 00163 } |
|
Definition at line 241 of file giffunc.c. References Gif_Image::height, i, Gif_Stream::images, Gif_Image::left, Gif_Stream::nimages, Gif_Stream::screen_height, Gif_Stream::screen_width, Gif_Image::top, and Gif_Image::width. Referenced by compare(), Gif_Unoptimize(), initialize_optimizer(), merge_frame_interval(), resize_stream(), and write_logical_screen_descriptor().
00242 { 00243 int i; 00244 int screen_width = 0; 00245 int screen_height = 0; 00246 00247 for (i = 0; i < gfs->nimages; i++) { 00248 Gif_Image *gfi = gfs->images[i]; 00249 /* 17.Dec.1999 - I find this old behavior annoying. */ 00250 /* if (gfi->left != 0 || gfi->top != 0) continue; */ 00251 if (screen_width < gfi->left + gfi->width) 00252 screen_width = gfi->left + gfi->width; 00253 if (screen_height < gfi->top + gfi->height) 00254 screen_height = gfi->top + gfi->height; 00255 } 00256 00257 /* Only use the default 640x480 screen size if we are being forced to create 00258 a new screen size or there's no screen size currently. */ 00259 if (screen_width == 0 && (force || gfs->screen_width == 0)) 00260 screen_width = 640; 00261 if (screen_height == 0 && (force || gfs->screen_height == 0)) 00262 screen_height = 480; 00263 00264 if (gfs->screen_width < screen_width || force) 00265 gfs->screen_width = screen_width; 00266 if (gfs->screen_height < screen_height || force) 00267 gfs->screen_height = screen_height; 00268 } |
|
Definition at line 644 of file giffunc.c. References Gif_Image::height, Gif_Image::img, left, Gif_Image::left, top, Gif_Image::top, and Gif_Image::width. Referenced by apply_image(), and initialize_optimizer().
00645 { 00646 int new_width = gfi->width, new_height = gfi->height; 00647 int y; 00648 00649 if (!gfi->img) return 0; 00650 00651 if (gfi->left < left) { 00652 int shift = left - gfi->left; 00653 for (y = 0; y < gfi->height; y++) 00654 gfi->img[y] += shift; 00655 gfi->left += shift; 00656 new_width -= shift; 00657 } 00658 00659 if (gfi->top < top) { 00660 int shift = top - gfi->top; 00661 for (y = gfi->height - 1; y >= shift; y++) 00662 gfi->img[y - shift] = gfi->img[y]; 00663 gfi->top += shift; 00664 new_height -= shift; 00665 } 00666 00667 if (gfi->left + new_width >= width) 00668 new_width = width - gfi->left; 00669 00670 if (gfi->top + new_height >= height) 00671 new_height = height - gfi->top; 00672 00673 if (new_width < 0) new_width = 0; 00674 if (new_height < 0) new_height = 0; 00675 gfi->width = new_width; 00676 gfi->height = new_height; 00677 return 1; 00678 } |
|
Definition at line 544 of file giffunc.c. References GIF_COLOREQ.
00545 { 00546 return GIF_COLOREQ(c1, c2); 00547 } |
|
Definition at line 771 of file gifwrite.c. References Gif_FullCompressImage().
00772 { 00773 return Gif_FullCompressImage(gfs, gfi, 0); 00774 } |
|
Definition at line 306 of file giffunc.c. References Gif_Colormap::capacity, Gif_Colormap::col, Gif_NewFullColormap(), i, and Gif_Colormap::ncol. Referenced by colormap_stream(), Gif_CopyImage(), Gif_CopyStreamSkeleton(), and read_colormap_file().
00307 { 00308 int i; 00309 Gif_Colormap *dest; 00310 if (!src) return 0; 00311 00312 dest = Gif_NewFullColormap(src->ncol, src->capacity); 00313 if (!dest) return 0; 00314 00315 for (i = 0; i < src->ncol; i++) { 00316 dest->col[i] = src->col[i]; 00317 dest->col[i].haspixel = 0; 00318 } 00319 00320 return dest; 00321 } |
|
Definition at line 325 of file giffunc.c. References Gif_Image::comment, Gif_Image::compressed, Gif_Image::compressed_len, Gif_Comment::count, Gif_Image::delay, Gif_Image::disposal, Gif_Image::free_compressed, Gif_Image::free_image_data, Gif_AddComment(), Gif_CopyColormap(), Gif_CopyString(), Gif_DeleteArrayFunc, Gif_DeleteImage(), Gif_NewArray, Gif_NewComment(), Gif_NewImage(), Gif_Image::height, i, Gif_Image::identifier, Gif_Image::image_data, Gif_Image::img, Gif_Image::interlace, Gif_Image::left, Gif_Comment::len, Gif_Image::local, Gif_Comment::str, Gif_Image::top, Gif_Image::transparent, and Gif_Image::width. Referenced by Gif_CopyStreamImages(), and merge_frame_interval().
00326 { 00327 Gif_Image *dest; 00328 byte *data; 00329 int i; 00330 if (!src) return 0; 00331 00332 dest = Gif_NewImage(); 00333 if (!dest) return 0; 00334 00335 dest->identifier = Gif_CopyString(src->identifier); 00336 if (!dest->identifier && src->identifier) goto failure; 00337 if (src->comment) { 00338 dest->comment = Gif_NewComment(); 00339 if (!dest->comment) goto failure; 00340 for (i = 0; i < src->comment->count; i++) 00341 if (!Gif_AddComment(dest->comment, src->comment->str[i], 00342 src->comment->len[i])) 00343 goto failure; 00344 } 00345 00346 dest->local = Gif_CopyColormap(src->local); 00347 if (!dest->local && src->local) goto failure; 00348 dest->transparent = src->transparent; 00349 00350 dest->delay = src->delay; 00351 dest->disposal = src->disposal; 00352 dest->left = src->left; 00353 dest->top = src->top; 00354 00355 dest->width = src->width; 00356 dest->height = src->height; 00357 00358 dest->interlace = src->interlace; 00359 if (src->img) { 00360 dest->img = Gif_NewArray(byte *, dest->height + 1); 00361 dest->image_data = Gif_NewArray(byte, dest->width * dest->height); 00362 dest->free_image_data = Gif_DeleteArrayFunc; 00363 if (!dest->img || !dest->image_data) goto failure; 00364 for (i = 0, data = dest->image_data; i < dest->height; i++) { 00365 memcpy(data, src->img[i], dest->width); 00366 dest->img[i] = data; 00367 data += dest->width; 00368 } 00369 dest->img[dest->height] = 0; 00370 } 00371 if (src->compressed) { 00372 if (src->free_compressed == 0) 00373 dest->compressed = src->compressed; 00374 else { 00375 dest->compressed = Gif_NewArray(byte, src->compressed_len); 00376 dest->free_compressed = Gif_DeleteArrayFunc; 00377 memcpy(dest->compressed, src->compressed, src->compressed_len); 00378 } 00379 dest->compressed_len = src->compressed_len; 00380 } 00381 00382 return dest; 00383 00384 failure: 00385 Gif_DeleteImage(dest); 00386 return 0; 00387 } |
|
Definition at line 289 of file giffunc.c. References Gif_AddImage(), Gif_CopyImage(), Gif_CopyStreamSkeleton(), Gif_DeleteStream(), i, Gif_Stream::images, and Gif_Stream::nimages.
00290 { 00291 Gif_Stream *ngfs = Gif_CopyStreamSkeleton(gfs); 00292 int i; 00293 if (!ngfs) return 0; 00294 for (i = 0; i < gfs->nimages; i++) { 00295 Gif_Image *gfi = Gif_CopyImage(gfs->images[i]); 00296 if (!gfi || !Gif_AddImage(ngfs, gfi)) { 00297 Gif_DeleteStream(ngfs); 00298 return 0; 00299 } 00300 } 00301 return ngfs; 00302 } |
|
Definition at line 272 of file giffunc.c. References Gif_Stream::background, Gif_CopyColormap(), Gif_DeleteStream(), Gif_NewStream(), Gif_Stream::global, Gif_Stream::loopcount, Gif_Stream::screen_height, and Gif_Stream::screen_width. Referenced by Gif_CopyStreamImages().
00273 { 00274 Gif_Stream *ngfs = Gif_NewStream(); 00275 ngfs->global = Gif_CopyColormap(gfs->global); 00276 ngfs->background = gfs->background; 00277 ngfs->screen_width = gfs->screen_width; 00278 ngfs->screen_height = gfs->screen_height; 00279 ngfs->loopcount = gfs->loopcount; 00280 if (gfs->global && !ngfs->global) { 00281 Gif_DeleteStream(ngfs); 00282 return 0; 00283 } else 00284 return ngfs; 00285 } |
|
Definition at line 137 of file giffunc.c. References Gif_NewArray, and l. Referenced by Gif_CopyImage(), Gif_NewExtension(), merge_frame_interval(), merge_image(), and merger_flatten().
00138 { 00139 int l; 00140 char *copy; 00141 if (!s) return 0; 00142 l = strlen(s); 00143 copy = Gif_NewArray(char, l + 1); 00144 if (!copy) return 0; 00145 memcpy(copy, s, l + 1); 00146 return copy; 00147 } |
|
Definition at line 726 of file giffunc.c. References Gif_DeleteArrayFunc, Gif_NewArray, Gif_SetUncompressedImage(), Gif_Image::height, Gif_Image::interlace, and Gif_Image::width. Referenced by merge_image(), and uncompress_image().
00727 { 00728 byte *data = Gif_NewArray(byte, gfi->width * gfi->height); 00729 return Gif_SetUncompressedImage(gfi, data, Gif_DeleteArrayFunc, 00730 gfi->interlace); 00731 } |
|
Definition at line 458 of file giffunc.c. References Gif_DeletionHook::callback_data, Gif_Colormap::col, Gif_DeletionHook::func, Gif_Delete, Gif_DeleteArray, GIF_T_COLORMAP, Gif_DeletionHook::kind, Gif_DeletionHook::next, and Gif_Colormap::refcount. Referenced by colormap_stream(), combine_output_options(), compare(), do_colormap_change(), finalize_optimizer(), Gif_DeleteImage(), Gif_DeleteStream(), main(), pipe_color_transformer(), prepare_colormap(), and read_text_colormap().
00459 { 00460 Gif_DeletionHook *hook; 00461 if (!gfcm) return; 00462 if (--gfcm->refcount > 0) return; 00463 00464 for (hook = all_hooks; hook; hook = hook->next) 00465 if (hook->kind == GIF_T_COLORMAP) 00466 (*hook->func)(GIF_T_COLORMAP, gfcm, hook->callback_data); 00467 00468 Gif_DeleteArray(gfcm->col); 00469 Gif_Delete(gfcm); 00470 } |
|
Definition at line 474 of file giffunc.c. References Gif_Comment::count, Gif_Delete, Gif_DeleteArray, i, Gif_Comment::len, and Gif_Comment::str. Referenced by blank_frameset(), fix_total_crop(), Gif_DeleteImage(), Gif_DeleteStream(), main(), and merge_frame_interval().
00475 { 00476 int i; 00477 if (!gfcom) return; 00478 for (i = 0; i < gfcom->count; i++) 00479 Gif_DeleteArray(gfcom->str[i]); 00480 Gif_DeleteArray(gfcom->str); 00481 Gif_DeleteArray(gfcom->len); 00482 Gif_Delete(gfcom); 00483 } |
|
Definition at line 487 of file giffunc.c. References Gif_Extension::application, Gif_Extension::data, Gif_Stream::extensions, Gif_Extension::free_data, Gif_Delete, Gif_DeleteArray, Gif_Extension::next, and Gif_Extension::stream. Referenced by copy_extension(), Gif_DeleteStream(), and Gif_NewExtension().
00488 { 00489 if (!gfex) return; 00490 if (gfex->data && gfex->free_data) 00491 (*gfex->free_data)(gfex->data); 00492 Gif_DeleteArray(gfex->application); 00493 if (gfex->stream) { 00494 Gif_Stream *gfs = gfex->stream; 00495 Gif_Extension *prev, *trav; 00496 for (prev = 0, trav = gfs->extensions; 00497 trav && trav != gfex; 00498 prev = trav, trav = trav->next) 00499 ; 00500 if (trav) { 00501 if (prev) prev->next = trav->next; 00502 else gfs->extensions = trav->next; 00503 } 00504 } 00505 Gif_Delete(gfex); 00506 } |
|
Definition at line 433 of file giffunc.c. References Gif_DeletionHook::callback_data, Gif_Image::comment, Gif_Image::compressed, Gif_Image::free_compressed, Gif_Image::free_image_data, Gif_Image::free_user_data, Gif_DeletionHook::func, Gif_Delete, Gif_DeleteArray, Gif_DeleteColormap(), Gif_DeleteComment(), GIF_T_IMAGE, Gif_Image::identifier, Gif_Image::image_data, Gif_Image::img, Gif_DeletionHook::kind, Gif_Image::local, Gif_DeletionHook::next, Gif_Image::refcount, and Gif_Image::user_data. Referenced by Gif_CopyImage(), Gif_DeleteStream(), Gif_RemoveImage(), merge_frame_interval(), and read_gif().
00434 { 00435 Gif_DeletionHook *hook; 00436 if (!gfi) return; 00437 if (--gfi->refcount > 0) return; 00438 00439 for (hook = all_hooks; hook; hook = hook->next) 00440 if (hook->kind == GIF_T_IMAGE) 00441 (*hook->func)(GIF_T_IMAGE, gfi, hook->callback_data); 00442 00443 Gif_DeleteArray(gfi->identifier); 00444 Gif_DeleteComment(gfi->comment); 00445 Gif_DeleteColormap(gfi->local); 00446 if (gfi->image_data && gfi->free_image_data) 00447 (*gfi->free_image_data)((void *)gfi->image_data); 00448 Gif_DeleteArray(gfi->img); 00449 if (gfi->compressed && gfi->free_compressed) 00450 (*gfi->free_compressed)((void *)gfi->compressed); 00451 if (gfi->user_data && gfi->free_user_data) 00452 (*gfi->free_user_data)(gfi->user_data); 00453 Gif_Delete(gfi); 00454 } |
|
|
Definition at line 551 of file giffunc.c. References c, Gif_Colormap::col, GIF_COLOREQ, i, and Gif_Colormap::ncol. Referenced by find_color_or_error().
|
|
Definition at line 417 of file gifwrite.c. References Gif_Writer::block_putter, Gif_Writer::byte_putter, calculate_min_code_bits(), Gif_Writer::cap, Gif_Image::compressed, Gif_Image::compressed_len, flags, Gif_Writer::flags, Gif_Image::free_compressed, Gif_Code, Gif_DeleteArray, Gif_DeleteArrayFunc, GIF_MAX_CODE, Gif_NewArray, memory_block_putter(), memory_byte_putter(), Gif_Writer::pos, Gif_Context::rle_next, Gif_Writer::v, and write_image_data(). Referenced by calculate_min_code_bits(), Gif_CompressImage(), merge_frame_interval(), and transp_frame_data().
00418 { 00419 int ok = 0; 00420 byte min_code_bits; 00421 Gif_Writer grr; 00422 Gif_Context gfc; 00423 00424 if (gfi->compressed && gfi->free_compressed) { 00425 (*gfi->free_compressed)((void *)gfi->compressed); 00426 gfi->compressed = 0; 00427 } 00428 00429 gfc.nodes = Gif_NewArray(Gif_Node, NODES_SIZE); 00430 gfc.links = Gif_NewArray(Gif_Node *, LINKS_SIZE); 00431 00432 grr.v = Gif_NewArray(byte, 1024); 00433 grr.pos = 0; 00434 grr.cap = 1024; 00435 grr.byte_putter = memory_byte_putter; 00436 grr.block_putter = memory_block_putter; 00437 grr.flags = flags; 00438 grr.global_size = get_color_table_size(gfs, 0, &grr); 00439 grr.local_size = get_color_table_size(gfs, gfi, &grr); 00440 00441 if (!gfc.nodes || !gfc.links || !grr.v) 00442 goto done; 00443 00444 min_code_bits = calculate_min_code_bits(gfs, gfi, &grr); 00445 ok = write_image_data(gfi, min_code_bits, &gfc, &grr); 00446 00447 done: 00448 if (!ok) { 00449 Gif_DeleteArray(grr.v); 00450 grr.v = 0; 00451 } 00452 gfi->compressed = grr.v; 00453 gfi->compressed_len = grr.pos; 00454 gfi->free_compressed = Gif_DeleteArrayFunc; 00455 Gif_DeleteArray(gfc.nodes); 00456 Gif_DeleteArray(gfc.links); 00457 return grr.v != 0; 00458 } |
|
Definition at line 857 of file gifread.c. References Gif_Reader::block_getter, Gif_Reader::byte_getter, Gif_Reader::eofer, Gif_Reader::f, file_block_getter(), file_byte_getter(), file_eofer(), file_offseter(), Gif_ReadErrorHandler, Gif_Reader::is_record, Gif_Reader::offseter, and read_gif(). Referenced by get_input_stream(), Gif_ReadFile(), input_stream(), and main().
00859 { 00860 Gif_Reader grr; 00861 if (!f) return 0; 00862 grr.f = f; 00863 grr.is_record = 0; 00864 grr.byte_getter = file_byte_getter; 00865 grr.block_getter = file_block_getter; 00866 grr.offseter = file_offseter; 00867 grr.eofer = file_eofer; 00868 return read_gif(&grr, read_flags, h, hthunk); 00869 } |
|
Definition at line 872 of file gifread.c. References Gif_Record::data, GIF_READ_COMPRESSED, GIF_READ_CONST_RECORD, Gif_ReadErrorHandler, Gif_Record::length, make_data_reader(), and read_gif(). Referenced by Gif_ReadRecord().
00874 { 00875 Gif_Reader grr; 00876 if (!gifrec) return 0; 00877 make_data_reader(&grr, gifrec->data, gifrec->length); 00878 if (read_flags & GIF_READ_CONST_RECORD) 00879 read_flags |= GIF_READ_COMPRESSED; 00880 return read_gif(&grr, read_flags, h, hthunk); 00881 } |
|
Definition at line 502 of file gifread.c. References Gif_Image::compressed, Gif_Image::compressed_len, Gif_Stream::errors, Gif_Code, Gif_DeleteArray, GIF_MAX_CODE, Gif_NewArray, Gif_ReadErrorHandler, Gif_Context::handler, Gif_Context::handler_thunk, Gif_Image::image_data, Gif_Image::img, Gif_Context::length, make_data_reader(), Gif_Context::prefix, Gif_Context::stream, Gif_Context::suffix, u_int16_t, and uncompress_image().
00503 { 00504 Gif_Context gfc; 00505 Gif_Stream fake_gfs; 00506 Gif_Reader grr; 00507 int ok = 0; 00508 00509 /* return right away if image is already uncompressed. this might screw over 00510 people who expect re-uncompressing to restore the compressed version. */ 00511 if (gfi->img) 00512 return 1; 00513 if (gfi->image_data) 00514 /* we have uncompressed data, but not an `img' array; 00515 this shouldn't happen */ 00516 return 0; 00517 00518 fake_gfs.errors = 0; 00519 gfc.stream = &fake_gfs; 00520 gfc.prefix = Gif_NewArray(Gif_Code, GIF_MAX_CODE); 00521 gfc.suffix = Gif_NewArray(byte, GIF_MAX_CODE); 00522 gfc.length = Gif_NewArray(u_int16_t, GIF_MAX_CODE); 00523 gfc.handler = h; 00524 gfc.handler_thunk = hthunk; 00525 00526 if (gfi && gfc.prefix && gfc.suffix && gfc.length && gfi->compressed) { 00527 make_data_reader(&grr, gfi->compressed, gfi->compressed_len); 00528 ok = uncompress_image(&gfc, gfi, &grr); 00529 } 00530 00531 Gif_DeleteArray(gfc.prefix); 00532 Gif_DeleteArray(gfc.suffix); 00533 Gif_DeleteArray(gfc.length); 00534 return ok && !fake_gfs.errors; 00535 } |
|
Definition at line 756 of file gifwrite.c. References Gif_Writer::block_putter, Gif_Writer::byte_putter, Gif_Writer::f, file_block_putter(), file_byte_putter(), flags, Gif_Writer::flags, and write_gif(). Referenced by Gif_WriteFile(), and write_stream().
00757 { 00758 Gif_Writer grr; 00759 grr.f = f; 00760 grr.byte_putter = file_byte_putter; 00761 grr.block_putter = file_block_putter; 00762 grr.flags = flags; 00763 return write_gif(gfs, &grr); 00764 } |
|
Definition at line 609 of file giffunc.c. References Gif_Stream::extensions, Gif_Extension::kind, and Gif_Extension::next.
00610 { 00611 if (!search_from) search_from = gfs->extensions; 00612 while (search_from) { 00613 if (search_from->kind == id) 00614 return search_from; 00615 search_from = search_from->next; 00616 } 00617 return 0; 00618 } |
|
Definition at line 582 of file giffunc.c. References Gif_Stream::images, and Gif_Stream::nimages. Referenced by show_frame().
00583 { 00584 if (imagenumber >= 0 && imagenumber < gfs->nimages) 00585 return gfs->images[imagenumber]; 00586 else 00587 return 0; 00588 } |
|
Definition at line 592 of file giffunc.c. References i, Gif_Stream::images, name, and Gif_Stream::nimages. Referenced by frame_argument(), and parse_frame_spec().
|
|
Definition at line 230 of file giffunc.c. References i, Gif_Stream::images, and Gif_Stream::nimages. Referenced by frame_argument(), image_info(), output_frames(), and parse_frame_spec().
|
|
HOOKS AND MISCELLANEOUS * Definition at line 682 of file giffunc.c. Referenced by Gif_SetUncompressedImage(), and write_image_data().
00683 { 00684 height--; 00685 if (line > height / 2) 00686 return line * 2 - ( height | 1); 00687 else if (line > height / 4) 00688 return line * 4 - ((height & ~1) | 2); 00689 else if (line > height / 8) 00690 return line * 8 - ((height & ~3) | 4); 00691 else 00692 return line * 8; 00693 } |
|
Definition at line 72 of file giffunc.c. References Gif_Colormap::capacity, Gif_Colormap::col, Gif_New, Gif_Colormap::ncol, Gif_Colormap::refcount, and Gif_Colormap::userflags.
00073 { 00074 Gif_Colormap *gfcm = Gif_New(Gif_Colormap); 00075 if (!gfcm) return 0; 00076 gfcm->ncol = 0; 00077 gfcm->capacity = 0; 00078 gfcm->col = 0; 00079 gfcm->refcount = 0; 00080 gfcm->userflags = 0; 00081 return gfcm; 00082 } |
|
Definition at line 105 of file giffunc.c. References Gif_Comment::cap, Gif_Comment::count, Gif_New, Gif_Comment::len, and Gif_Comment::str. Referenced by fix_total_crop(), Gif_CopyImage(), main(), merge_frame_interval(), merge_image(), merge_stream(), and read_comment_extension().
00106 { 00107 Gif_Comment *gfcom = Gif_New(Gif_Comment); 00108 if (!gfcom) return 0; 00109 gfcom->str = 0; 00110 gfcom->len = 0; 00111 gfcom->count = gfcom->cap = 0; 00112 return gfcom; 00113 } |
|
Definition at line 117 of file giffunc.c. References Gif_Extension::application, Gif_Extension::data, Gif_Extension::free_data, Gif_CopyString(), Gif_DeleteExtension(), Gif_New, Gif_Extension::kind, Gif_Extension::next, Gif_Extension::position, and Gif_Extension::stream. Referenced by copy_extension(), handle_extension(), and read_unknown_extension().
00118 { 00119 Gif_Extension *gfex = Gif_New(Gif_Extension); 00120 if (!gfex) return 0; 00121 gfex->kind = app_name ? 255 : kind; 00122 gfex->application = Gif_CopyString(app_name); 00123 gfex->data = 0; 00124 gfex->position = 0; 00125 gfex->stream = 0; 00126 gfex->next = 0; 00127 gfex->free_data = 0; 00128 if (!gfex->application && app_name) { 00129 Gif_DeleteExtension(gfex); 00130 return 0; 00131 } 00132 return gfex; 00133 } |
|
Definition at line 86 of file giffunc.c. References Gif_Colormap::capacity, Gif_Colormap::col, Gif_Delete, Gif_New, Gif_NewArray, Gif_Colormap::ncol, Gif_Colormap::refcount, and Gif_Colormap::userflags. Referenced by colormap_diversity(), colormap_median_cut(), compare(), create_out_global_map(), Gif_CopyColormap(), initialize_optimizer(), merge_frame_interval(), merge_image(), prepare_colormap(), read_color_table(), read_text_colormap(), and set_new_fixed_colormap().
00087 { 00088 Gif_Colormap *gfcm = Gif_New(Gif_Colormap); 00089 if (!gfcm || capacity <= 0 || count < 0) return 0; 00090 if (count > capacity) capacity = count; 00091 gfcm->ncol = count; 00092 gfcm->capacity = capacity; 00093 gfcm->col = Gif_NewArray(Gif_Color, capacity); 00094 gfcm->refcount = 0; 00095 gfcm->userflags = 0; 00096 if (!gfcm->col) { 00097 Gif_Delete(gfcm); 00098 return 0; 00099 } else 00100 return gfcm; 00101 } |
|
|
Definition at line 26 of file giffunc.c. References Gif_Stream::background, Gif_Stream::comment, Gif_Stream::errors, Gif_Stream::extensions, Gif_New, Gif_Stream::global, Gif_Stream::images, Gif_Stream::imagescap, Gif_Stream::loopcount, Gif_Stream::nimages, Gif_Stream::refcount, Gif_Stream::screen_height, Gif_Stream::screen_width, and Gif_Stream::userflags. Referenced by Gif_CopyStreamSkeleton(), merge_frame_interval(), and read_gif().
00027 { 00028 Gif_Stream *gfs = Gif_New(Gif_Stream); 00029 if (!gfs) return 0; 00030 gfs->global = 0; 00031 gfs->background = 0; 00032 gfs->screen_width = gfs->screen_height = 0; 00033 gfs->loopcount = -1; 00034 gfs->comment = 0; 00035 gfs->images = 0; 00036 gfs->nimages = gfs->imagescap = 0; 00037 gfs->extensions = 0; 00038 gfs->errors = 0; 00039 gfs->userflags = 0; 00040 gfs->refcount = 0; 00041 return gfs; 00042 } |
|
Definition at line 888 of file gifread.c. References Gif_FullReadFile(), and GIF_READ_UNCOMPRESSED.
00889 { 00890 return Gif_FullReadFile(f, GIF_READ_UNCOMPRESSED, 0, 0); 00891 } |
|
Definition at line 894 of file gifread.c. References Gif_FullReadRecord(), and GIF_READ_UNCOMPRESSED.
00895 { 00896 return Gif_FullReadRecord(gifrec, GIF_READ_UNCOMPRESSED, 0, 0); 00897 } |
|
Definition at line 622 of file giffunc.c. References Gif_Image::compressed, Gif_Image::compressed_len, and Gif_Image::free_compressed. Referenced by apply_image(), create_subimages(), merge_frame_interval(), scale_image(), transp_frame_data(), and unoptimize_image().
00623 {
00624 if (gfi->compressed && gfi->free_compressed)
00625 (*gfi->free_compressed)(gfi->compressed);
00626 gfi->compressed = 0;
00627 gfi->compressed_len = 0;
00628 gfi->free_compressed = 0;
00629 }
|
|
Definition at line 632 of file giffunc.c. References Gif_Image::free_image_data, Gif_DeleteArray, Gif_Image::image_data, and Gif_Image::img. Referenced by apply_image(), colormap_stream(), create_new_image_data(), Gif_SetUncompressedImage(), Gif_XSubMask(), merge_frame_interval(), put_sub_image_colormap(), rotate_image(), scale_image(), and transp_frame_data().
00633 { 00634 Gif_DeleteArray(gfi->img); 00635 if (gfi->image_data && gfi->free_image_data) 00636 (*gfi->free_image_data)(gfi->image_data); 00637 gfi->img = 0; 00638 gfi->image_data = 0; 00639 gfi->free_image_data = 0; 00640 } |
|
|
|
Definition at line 167 of file giffunc.c. References Gif_DeleteImage(), Gif_Stream::images, and Gif_Stream::nimages.
00168 { 00169 int j; 00170 if (inum < 0 || inum >= gfs->nimages) 00171 return; 00172 Gif_DeleteImage(gfs->images[inum]); 00173 for (j = inum; j < gfs->nimages - 1; j++) 00174 gfs->images[j] = gfs->images[j+1]; 00175 gfs->nimages--; 00176 } |
|
Definition at line 697 of file giffunc.c. References Gif_Image::free_image_data, Gif_InterlaceLine(), Gif_NewArray, Gif_ReleaseUncompressedImage(), Gif_Image::height, i, Gif_Image::image_data, Gif_Image::img, and Gif_Image::width. Referenced by colormap_stream(), create_new_image_data(), Gif_CreateUncompressedImage(), rotate_image(), scale_image(), and unoptimize_image().
00699 { 00700 int i; 00701 int width = gfi->width; 00702 int height = gfi->height; 00703 byte **img; 00704 00705 Gif_ReleaseUncompressedImage(gfi); 00706 if (!image_data) return 0; 00707 00708 img = Gif_NewArray(byte *, height + 1); 00709 if (!img) return 0; 00710 00711 if (data_interlaced) 00712 for (i = 0; i < height; i++) 00713 img[ Gif_InterlaceLine(i, height) ] = image_data + width * i; 00714 else 00715 for (i = 0; i < height; i++) 00716 img[i] = image_data + width * i; 00717 img[height] = 0; 00718 00719 gfi->img = img; 00720 gfi->image_data = image_data; 00721 gfi->free_image_data = free_data; 00722 return 1; 00723 } |
|
Definition at line 158 of file gifunopt.c. References Gif_Stream::background, Gif_CalculateScreenSize(), Gif_DeleteArray, Gif_NewArray, Gif_Stream::global, i, Gif_Stream::images, Gif_Stream::nimages, Gif_Stream::screen_height, Gif_Stream::screen_width, Gif_Image::transparent, TRANSPARENT, u_int16_t, and unoptimize_image(). Referenced by input_stream().
00159 { 00160 int ok = 1; 00161 int i, size; 00162 u_int16_t *screen; 00163 u_int16_t background; 00164 Gif_Image *gfi; 00165 00166 if (gfs->nimages < 1) return 1; 00167 for (i = 0; i < gfs->nimages; i++) 00168 if (gfs->images[i]->local) 00169 return 0; 00170 if (!gfs->global) 00171 return 0; 00172 00173 Gif_CalculateScreenSize(gfs, 0); 00174 size = gfs->screen_width * gfs->screen_height; 00175 00176 screen = Gif_NewArray(u_int16_t, size); 00177 gfi = gfs->images[0]; 00178 background = gfi->transparent >= 0 ? TRANSPARENT : gfs->background; 00179 for (i = 0; i < size; i++) 00180 screen[i] = background; 00181 00182 for (i = 0; i < gfs->nimages; i++) 00183 if (!unoptimize_image(gfs, gfs->images[i], screen)) 00184 ok = 0; 00185 00186 Gif_DeleteArray(screen); 00187 return ok; 00188 } |
|
Definition at line 777 of file gifwrite.c. References Gif_FullWriteFile().
00778 { 00779 return Gif_FullWriteFile(gfs, 0, f); 00780 } |