#include "../config.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "gif_lib.h"
#include "gif_lib_private.h"
Go to the source code of this file.
Defines | |
#define | WRITE(_gif, _buf, _len) |
Functions | |
static int | EGifPutWord (int Word, GifFileType *GifFile) |
static int | EGifSetupCompress (GifFileType *GifFile) |
static int | EGifCompressLine (GifFileType *GifFile, GifPixelType *Line, int LineLen) |
static int | EGifCompressOutput (GifFileType *GifFile, int Code) |
static int | EGifBufferedOutput (GifFileType *GifFile, GifByteType *Buf, int c) |
GifFileType * | EGifOpenFileHandle (int FileHandle) |
GifFileType * | EGifOpen (void *userData, OutputFunc writeFunc) |
void | EGifSetGifVersion (const char *Version) |
int | EGifPutScreenDesc (GifFileType *GifFile, int Width, int Height, int ColorRes, int BackGround, const ColorMapObject *ColorMap) |
int | EGifPutImageDesc (GifFileType *GifFile, int Left, int Top, int Width, int Height, int Interlace, const ColorMapObject *ColorMap) |
int | EGifPutLine (GifFileType *GifFile, GifPixelType *Line, int LineLen) |
int | EGifPutComment (GifFileType *GifFile, const char *Comment) |
int | EGifPutExtensionFirst (GifFileType *GifFile, int ExtCode, int ExtLen, const VoidPtr Extension) |
int | EGifPutExtensionNext (GifFileType *GifFile, int ExtCode, int ExtLen, const VoidPtr Extension) |
int | EGifPutExtensionLast (GifFileType *GifFile, int ExtCode, int ExtLen, const VoidPtr Extension) |
int | EGifPutExtension (GifFileType *GifFile, int ExtCode, int ExtLen, const VoidPtr Extension) |
int | EGifCloseFile (GifFileType *GifFile) |
Variables | |
static GifPixelType | CodeMask [] |
static unsigned char | GifVersionPrefix [GIF_STAMP_LEN+1] = GIF87_STAMP |
static int | GifVersionPrefixLen = GIF_STAMP_LEN |
#define WRITE | ( | _gif, | |||
_buf, | |||||
_len | ) |
Value:
(((GifFilePrivateType*)_gif->Private)->Write ? \ ((GifFilePrivateType*)_gif->Private)->Write(_gif,(unsigned char *)_buf,(int)_len) : \ fwrite(_buf, 1, _len, ((GifFilePrivateType*)_gif->Private)->File))
Definition at line 56 of file egif_lib.c.
Referenced by EGifBufferedOutput(), EGifCloseFile(), EGifPutExtension(), EGifPutImageDesc(), EGifPutScreenDesc(), EGifPutWord(), and EGifSetupCompress().
static int EGifBufferedOutput | ( | GifFileType * | GifFile, | |
GifByteType * | Buf, | |||
int | c | |||
) | [static] |
Definition at line 783 of file egif_lib.c.
References _GifError, E_GIF_ERR_WRITE_FAILED, FLUSH_OUTPUT, GIF_ERROR, GIF_OK, and WRITE.
Referenced by EGifCompressOutput().
int EGifCloseFile | ( | GifFileType * | GifFile | ) |
Definition at line 536 of file egif_lib.c.
References _GifError, GifImageDesc::ColorMap, E_GIF_ERR_CLOSE_FAILED, E_GIF_ERR_NOT_WRITEABLE, fclose(), GifFilePrivateType::File, File, free(), FreeMapObject(), GIF_ERROR, GIF_OK, GifFilePrivateType::HashTable, if(), GifFileType::Image, IS_WRITEABLE, NULL, GifFileType::Private, GifFileType::SColorMap, and WRITE.
Referenced by ASImage2gif().
static int EGifCompressLine | ( | GifFileType * | GifFile, | |
GifPixelType * | Line, | |||
int | LineLen | |||
) | [static] |
Definition at line 650 of file egif_lib.c.
References _ClearHashTable(), _ExistsHashTable(), _GifError, _InsertHashTable(), GifFilePrivateType::BitsPerPixel, GifFilePrivateType::ClearCode, GifFilePrivateType::CrntCode, E_GIF_ERR_DISK_IS_FULL, EGifCompressOutput(), GifFilePrivateType::EOFCode, FIRST_CODE, FLUSH_OUTPUT, GIF_ERROR, GIF_OK, GifFilePrivateType::HashTable, i, if(), LZ_MAX_CODE, GifFilePrivateType::MaxCode1, GifFilePrivateType::PixelCount, GifFileType::Private, GifFilePrivateType::RunningBits, GifFilePrivateType::RunningCode, and UINT32.
Referenced by EGifPutLine().
static int EGifCompressOutput | ( | GifFileType * | GifFile, | |
int | Code | |||
) | [static] |
Definition at line 737 of file egif_lib.c.
References GifFilePrivateType::Buf, GifFilePrivateType::CrntShiftDWord, GifFilePrivateType::CrntShiftState, EGifBufferedOutput(), FLUSH_OUTPUT, GIF_ERROR, GIF_OK, if(), long, GifFilePrivateType::MaxCode1, GifFileType::Private, retval, GifFilePrivateType::RunningBits, and GifFilePrivateType::RunningCode.
Referenced by EGifCompressLine(), and EGifSetupCompress().
GifFileType* EGifOpen | ( | void * | userData, | |
OutputFunc | writeFunc | |||
) |
Definition at line 127 of file egif_lib.c.
References _GifError, _InitHashTable(), E_GIF_ERR_NOT_ENOUGH_MEM, GifFilePrivateType::File, FILE_STATE_WRITE, GifFilePrivateType::FileHandle, GifFilePrivateType::FileState, free(), GifFilePrivateType::HashTable, malloc(), NULL, GifFileType::Private, GifFileType::UserData, VoidPtr, and GifFilePrivateType::Write.
GifFileType* EGifOpenFileHandle | ( | int | FileHandle | ) |
Definition at line 74 of file egif_lib.c.
References _GifError, _InitHashTable(), E_GIF_ERR_NOT_ENOUGH_MEM, GifFilePrivateType::File, FILE_STATE_WRITE, GifFilePrivateType::FileHandle, GifFilePrivateType::FileState, free(), GIF_FILE_BUFFER_SIZE, GifFilePrivateType::HashTable, malloc(), NULL, O_BINARY, GifFileType::Private, GifFileType::UserData, VoidPtr, and GifFilePrivateType::Write.
Referenced by ASImage2gif().
int EGifPutComment | ( | GifFileType * | GifFile, | |
const char * | Comment | |||
) |
Definition at line 381 of file egif_lib.c.
References buf, COMMENT_EXT_FUNC_CODE, EGifPutExtension(), EGifPutExtensionFirst(), EGifPutExtensionLast(), EGifPutExtensionNext(), GIF_ERROR, GIF_OK, length, and NULL.
int EGifPutExtension | ( | GifFileType * | GifFile, | |
int | ExtCode, | |||
int | ExtLen, | |||
const VoidPtr | Extension | |||
) |
Definition at line 506 of file egif_lib.c.
References _GifError, E_GIF_ERR_NOT_WRITEABLE, GIF_ERROR, GIF_OK, if(), IS_WRITEABLE, GifFileType::Private, and WRITE.
Referenced by ASImage2gif(), EGifPutComment(), and write_gif_saved_images().
int EGifPutExtensionFirst | ( | GifFileType * | GifFile, | |
int | ExtCode, | |||
int | ExtLen, | |||
const VoidPtr | Extension | |||
) |
Definition at line 426 of file egif_lib.c.
References _GifError, E_GIF_ERR_NOT_WRITEABLE, GifFilePrivateType::File, fwrite, GIF_ERROR, GIF_OK, if(), IS_WRITEABLE, and GifFileType::Private.
Referenced by ASImage2gif(), and EGifPutComment().
int EGifPutExtensionLast | ( | GifFileType * | GifFile, | |
int | ExtCode, | |||
int | ExtLen, | |||
const VoidPtr | Extension | |||
) |
Definition at line 477 of file egif_lib.c.
References _GifError, E_GIF_ERR_NOT_WRITEABLE, GifFilePrivateType::File, fwrite, GIF_ERROR, GIF_OK, if(), IS_WRITEABLE, and GifFileType::Private.
Referenced by ASImage2gif(), and EGifPutComment().
int EGifPutExtensionNext | ( | GifFileType * | GifFile, | |
int | ExtCode, | |||
int | ExtLen, | |||
const VoidPtr | Extension | |||
) |
Definition at line 455 of file egif_lib.c.
References _GifError, E_GIF_ERR_NOT_WRITEABLE, GifFilePrivateType::File, fwrite, GIF_ERROR, GIF_OK, if(), IS_WRITEABLE, and GifFileType::Private.
Referenced by EGifPutComment().
int EGifPutImageDesc | ( | GifFileType * | GifFile, | |
int | Left, | |||
int | Top, | |||
int | Width, | |||
int | Height, | |||
int | Interlace, | |||
const ColorMapObject * | ColorMap | |||
) |
Definition at line 263 of file egif_lib.c.
References _GifError, ColorMapObject::BitsPerPixel, GifColorType::Blue, ColorMapObject::ColorCount, GifImageDesc::ColorMap, ColorMapObject::Colors, E_GIF_ERR_HAS_IMAG_DSCR, E_GIF_ERR_NO_COLOR_MAP, E_GIF_ERR_NOT_ENOUGH_MEM, E_GIF_ERR_NOT_WRITEABLE, E_GIF_ERR_WRITE_FAILED, EGifPutWord(), EGifSetupCompress(), FILE_STATE_IMAGE, GifFilePrivateType::FileState, GIF_ERROR, GIF_OK, GifColorType::Green, GifImageDesc::Height, i, if(), GifFileType::Image, GifImageDesc::Interlace, IS_WRITEABLE, GifImageDesc::Left, long, MakeMapObject(), NULL, GifFilePrivateType::PixelCount, GifFileType::Private, GifColorType::Red, GifImageDesc::Top, GifImageDesc::Width, and WRITE.
Referenced by ASImage2gif(), and write_gif_saved_images().
int EGifPutLine | ( | GifFileType * | GifFile, | |
GifPixelType * | Line, | |||
int | LineLen | |||
) |
Definition at line 350 of file egif_lib.c.
References _GifError, GifFilePrivateType::BitsPerPixel, CodeMask, E_GIF_ERR_DATA_TOO_BIG, E_GIF_ERR_NOT_WRITEABLE, EGifCompressLine(), GIF_ERROR, i, if(), GifFileType::Image, IS_WRITEABLE, GifFilePrivateType::PixelCount, GifFileType::Private, and GifImageDesc::Width.
Referenced by ASImage2gif(), and write_gif_saved_images().
int EGifPutScreenDesc | ( | GifFileType * | GifFile, | |
int | Width, | |||
int | Height, | |||
int | ColorRes, | |||
int | BackGround, | |||
const ColorMapObject * | ColorMap | |||
) |
Definition at line 181 of file egif_lib.c.
References _GifError, ColorMapObject::BitsPerPixel, GifColorType::Blue, ColorMapObject::ColorCount, ColorMapObject::Colors, E_GIF_ERR_HAS_SCRN_DSCR, E_GIF_ERR_NOT_ENOUGH_MEM, E_GIF_ERR_NOT_WRITEABLE, E_GIF_ERR_WRITE_FAILED, EGifPutWord(), FILE_STATE_SCREEN, GifFilePrivateType::FileState, GIF_ERROR, GIF_OK, GifVersionPrefix, GifVersionPrefixLen, GifColorType::Green, i, if(), IS_WRITEABLE, MakeMapObject(), NULL, GifFileType::Private, GifColorType::Red, GifFileType::SBackGroundColor, GifFileType::SColorMap, GifFileType::SColorResolution, GifFileType::SHeight, GifFileType::SWidth, and WRITE.
Referenced by ASImage2gif().
static int EGifPutWord | ( | int | Word, | |
GifFileType * | GifFile | |||
) | [static] |
Definition at line 583 of file egif_lib.c.
References c, GIF_ERROR, GIF_OK, and WRITE.
Referenced by EGifPutImageDesc(), and EGifPutScreenDesc().
void EGifSetGifVersion | ( | const char * | Version | ) |
static int EGifSetupCompress | ( | GifFileType * | GifFile | ) | [static] |
Definition at line 602 of file egif_lib.c.
References _ClearHashTable(), _GifError, ColorMapObject::BitsPerPixel, GifFilePrivateType::BitsPerPixel, GifFilePrivateType::Buf, GifFilePrivateType::ClearCode, GifImageDesc::ColorMap, GifFilePrivateType::CrntCode, GifFilePrivateType::CrntShiftDWord, GifFilePrivateType::CrntShiftState, E_GIF_ERR_DISK_IS_FULL, E_GIF_ERR_NO_COLOR_MAP, EGifCompressOutput(), GifFilePrivateType::EOFCode, FIRST_CODE, GIF_ERROR, GIF_OK, GifFilePrivateType::HashTable, if(), GifFileType::Image, GifFilePrivateType::MaxCode1, GifFileType::Private, GifFilePrivateType::RunningBits, GifFilePrivateType::RunningCode, GifFileType::SColorMap, and WRITE.
Referenced by EGifPutImageDesc().
GifPixelType CodeMask[] [static] |
Initial value:
{ 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff }
Definition at line 49 of file egif_lib.c.
Referenced by EGifPutLine().
unsigned char GifVersionPrefix[GIF_STAMP_LEN+1] = GIF87_STAMP [static] |
Definition at line 53 of file egif_lib.c.
Referenced by EGifPutScreenDesc(), and EGifSetGifVersion().
int GifVersionPrefixLen = GIF_STAMP_LEN [static] |