1
0

gif_lib_private.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /****************************************************************************
  2. gif_lib_private.h - internal giflib routines and structures
  3. ****************************************************************************/
  4. #ifndef _GIF_LIB_PRIVATE_H
  5. #define _GIF_LIB_PRIVATE_H
  6. #include "gif_lib.h"
  7. #include "gif_hash.h"
  8. #define EXTENSION_INTRODUCER 0x21
  9. #define DESCRIPTOR_INTRODUCER 0x2c
  10. #define TERMINATOR_INTRODUCER 0x3b
  11. #define LZ_MAX_CODE 4095 /* Biggest code possible in 12 bits. */
  12. #define LZ_BITS 12
  13. #define FLUSH_OUTPUT 4096 /* Impossible code, to signal flush. */
  14. #define FIRST_CODE 4097 /* Impossible code, to signal first. */
  15. #define NO_SUCH_CODE 4098 /* Impossible code, to signal empty. */
  16. #define FILE_STATE_WRITE 0x01
  17. #define FILE_STATE_SCREEN 0x02
  18. #define FILE_STATE_IMAGE 0x04
  19. #define FILE_STATE_READ 0x08
  20. #define IS_READABLE(Private) (Private->FileState & FILE_STATE_READ)
  21. #define IS_WRITEABLE(Private) (Private->FileState & FILE_STATE_WRITE)
  22. typedef struct GifFilePrivateType {
  23. GifWord FileState, FileHandle, /* Where all this data goes to! */
  24. BitsPerPixel, /* Bits per pixel (Codes uses at least this + 1). */
  25. ClearCode, /* The CLEAR LZ code. */
  26. EOFCode, /* The EOF LZ code. */
  27. RunningCode, /* The next code algorithm can generate. */
  28. RunningBits, /* The number of bits required to represent RunningCode. */
  29. MaxCode1, /* 1 bigger than max. possible code, in RunningBits bits. */
  30. LastCode, /* The code before the current code. */
  31. CrntCode, /* Current algorithm code. */
  32. StackPtr, /* For character stack (see below). */
  33. CrntShiftState; /* Number of bits in CrntShiftDWord. */
  34. unsigned long CrntShiftDWord; /* For bytes decomposition into codes. */
  35. unsigned long PixelCount; /* Number of pixels in image. */
  36. FILE *File; /* File as stream. */
  37. InputFunc Read; /* function to read gif input (TVT) */
  38. OutputFunc Write; /* function to write gif output (MRB) */
  39. GifByteType Buf[256]; /* Compressed input is buffered here. */
  40. GifByteType Stack[LZ_MAX_CODE]; /* Decoded pixels are stacked here. */
  41. GifByteType Suffix[LZ_MAX_CODE + 1]; /* So we can trace the codes. */
  42. GifPrefixType Prefix[LZ_MAX_CODE + 1];
  43. GifHashTableType *HashTable;
  44. bool gif89;
  45. } GifFilePrivateType;
  46. #endif /* _GIF_LIB_PRIVATE_H */
  47. /* end */