| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
#ifndef WEBP_EXAMPLES_GIFDEC_H_ |
| 13 |
#define WEBP_EXAMPLES_GIFDEC_H_ |
| 14 |
|
| 15 |
#include <stdio.h> |
| 16 |
#include "webp/types.h" |
| 17 |
|
| 18 |
#ifdef HAVE_CONFIG_H |
| 19 |
#include "webp/config.h" |
| 20 |
#endif |
| 21 |
|
| 22 |
#ifdef WEBP_HAVE_GIF |
| 23 |
#include <gif_lib.h> |
| 24 |
#endif |
| 25 |
|
| 26 |
#ifdef __cplusplus |
| 27 |
extern "C" { |
| 28 |
#endif |
| 29 |
|
| 30 |
|
| 31 |
#if defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) |
| 32 |
# define LOCAL_GIF_VERSION ((GIFLIB_MAJOR << 8) | GIFLIB_MINOR) |
| 33 |
# define LOCAL_GIF_PREREQ(maj, min) \ |
| 34 |
(LOCAL_GIF_VERSION >= (((maj) << 8) | (min))) |
| 35 |
#else |
| 36 |
# define LOCAL_GIF_VERSION 0 |
| 37 |
# define LOCAL_GIF_PREREQ(maj, min) 0 |
| 38 |
#endif |
| 39 |
|
| 40 |
#define GIF_INDEX_INVALID (-1) |
| 41 |
|
| 42 |
typedef enum GIFDisposeMethod { |
| 43 |
GIF_DISPOSE_NONE, |
| 44 |
GIF_DISPOSE_BACKGROUND, |
| 45 |
GIF_DISPOSE_RESTORE_PREVIOUS |
| 46 |
} GIFDisposeMethod; |
| 47 |
|
| 48 |
typedef struct { |
| 49 |
int x_offset, y_offset, width, height; |
| 50 |
} GIFFrameRect; |
| 51 |
|
| 52 |
struct WebPData; |
| 53 |
struct WebPPicture; |
| 54 |
|
| 55 |
#ifndef WEBP_HAVE_GIF |
| 56 |
struct ColorMapObject; |
| 57 |
struct GifFileType; |
| 58 |
typedef unsigned char GifByteType; |
| 59 |
#endif |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
void GIFGetBackgroundColor(const struct ColorMapObject* const color_map, |
| 64 |
int bgcolor_index, int transparent_index, |
| 65 |
uint32_t* const bgcolor); |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
int GIFReadGraphicsExtension(const GifByteType* const buf, int* const duration, |
| 71 |
GIFDisposeMethod* const dispose, |
| 72 |
int* const transparent_index); |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
int GIFReadFrame(struct GifFileType* const gif, int transparent_index, |
| 78 |
GIFFrameRect* const gif_rect, |
| 79 |
struct WebPPicture* const picture); |
| 80 |
|
| 81 |
|
| 82 |
int GIFReadLoopCount(struct GifFileType* const gif, GifByteType** const buf, |
| 83 |
int* const loop_count); |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
int GIFReadMetadata(struct GifFileType* const gif, GifByteType** const buf, |
| 88 |
struct WebPData* const metadata); |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
void GIFDisposeFrame(GIFDisposeMethod dispose, const GIFFrameRect* const rect, |
| 93 |
const struct WebPPicture* const prev_canvas, |
| 94 |
struct WebPPicture* const curr_canvas); |
| 95 |
|
| 96 |
|
| 97 |
void GIFBlendFrames(const struct WebPPicture* const src, |
| 98 |
const GIFFrameRect* const rect, |
| 99 |
struct WebPPicture* const dst); |
| 100 |
|
| 101 |
|
| 102 |
void GIFDisplayError(const struct GifFileType* const gif, int gif_error); |
| 103 |
|
| 104 |
|
| 105 |
void GIFClearPic(struct WebPPicture* const pic, const GIFFrameRect* const rect); |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
void GIFCopyPixels(const struct WebPPicture* const src, |
| 110 |
struct WebPPicture* const dst); |
| 111 |
|
| 112 |
#ifdef __cplusplus |
| 113 |
} |
| 114 |
#endif |
| 115 |
|
| 116 |
#endif |