jdk/src/share/native/sun/awt/giflib/gif_lib.h
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 2 90ce3da70b43
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     6
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     8
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
/******************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * In order to make life a little bit easier when using the GIF file format,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * this library was written, and which does all the dirty work...
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *                                        Written by Gershon Elber,  Jun. 1989
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 *                                        Hacks by Eric S. Raymond,  Sep. 1992
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 ******************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * History:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * 14 Jun 89 - Version 1.0 by Gershon Elber.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 *  3 Sep 90 - Version 1.1 by Gershon Elber (Support for Gif89, Unique names)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * 15 Sep 90 - Version 2.0 by Eric S. Raymond (Changes to suoport GIF slurp)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * 26 Jun 96 - Version 3.0 by Eric S. Raymond (Full GIF89 support)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * 17 Dec 98 - Version 4.0 by Toshio Kuratomi (Fix extension writing code)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *****************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
/* all encoding functionality stripped */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#ifndef _GIF_LIB_H_
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#define _GIF_LIB_H_ 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
#ifdef __cplusplus
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
extern "C" {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
#endif /* __cplusplus */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
#define GIF_LIB_VERSION " Version 4.1, "
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
#define GIF_ERROR   0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
#define GIF_OK      1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
#ifndef TRUE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
#define TRUE        1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
#endif /* TRUE */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
#ifndef FALSE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
#define FALSE       0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
#endif /* FALSE */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
#ifndef NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
#define NULL        0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
#endif /* NULL */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
#define GIF_STAMP "GIFVER"          /* First chars in file - GIF stamp.  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
#define GIF_STAMP_LEN sizeof(GIF_STAMP) - 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
#define GIF_VERSION_POS 3           /* Version first character in stamp. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
#define GIF87_STAMP "GIF87a"        /* First chars in file - GIF stamp.  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
#define GIF89_STAMP "GIF89a"        /* First chars in file - GIF stamp.  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
#define GIF_FILE_BUFFER_SIZE 16384  /* Files uses bigger buffers than usual. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
typedef int GifBooleanType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
typedef unsigned char GifPixelType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
typedef unsigned char *GifRowType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
typedef unsigned char GifByteType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
#define GIF_MESSAGE(Msg) fprintf(stderr, "\n%s: %s\n", PROGRAM_NAME, Msg)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
#define GIF_EXIT(Msg)    { GIF_MESSAGE(Msg); exit(-3); }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
#ifdef SYSV
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
#define VoidPtr char *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
#define VoidPtr void *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
#endif /* SYSV */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
typedef struct GifColorType {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    GifByteType Red, Green, Blue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
} GifColorType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
typedef struct ColorMapObject {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    int ColorCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    int BitsPerPixel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    GifColorType *Colors;    /* on malloc(3) heap */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
} ColorMapObject;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
typedef struct GifImageDesc {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    int Left, Top, Width, Height,   /* Current image dimensions. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
      Interlace;                    /* Sequential/Interlaced lines. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    ColorMapObject *ColorMap;       /* The local color map */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
} GifImageDesc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
typedef struct GifFileType {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    int SWidth, SHeight,        /* Screen dimensions. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
      SColorResolution,         /* How many colors can we generate? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
      SBackGroundColor;         /* I hope you understand this one... */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    ColorMapObject *SColorMap;  /* NULL if not exists. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    int ImageCount;             /* Number of current image */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    GifImageDesc Image;         /* Block describing current image */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    struct SavedImage *SavedImages; /* Use this to accumulate file state */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    VoidPtr UserData;           /* hook to attach user data (TVT) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    VoidPtr Private;            /* Don't mess with this! */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
} GifFileType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
typedef enum {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    UNDEFINED_RECORD_TYPE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    SCREEN_DESC_RECORD_TYPE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    IMAGE_DESC_RECORD_TYPE, /* Begin with ',' */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    EXTENSION_RECORD_TYPE,  /* Begin with '!' */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    TERMINATE_RECORD_TYPE   /* Begin with ';' */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
} GifRecordType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
/* DumpScreen2Gif routine constants identify type of window/screen to dump.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 * Note all values below 1000 are reserved for the IBMPC different display
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 * devices (it has many!) and are compatible with the numbering TC2.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 * (Turbo C 2.0 compiler for IBM PC) gives to these devices.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
typedef enum {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    GIF_DUMP_SGI_WINDOW = 1000,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    GIF_DUMP_X_WINDOW = 1001
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
} GifScreenDumpType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
/* func type to read gif data from arbitrary sources (TVT) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
typedef int (*InputFunc) (GifFileType *, GifByteType *, int);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
/* func type to write gif data ro arbitrary targets.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 * Returns count of bytes written. (MRB)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
typedef int (*OutputFunc) (GifFileType *, const GifByteType *, int);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
/******************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 *  GIF89 extension function codes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
******************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
#define COMMENT_EXT_FUNC_CODE     0xfe    /* comment */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
#define GRAPHICS_EXT_FUNC_CODE    0xf9    /* graphics control */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
#define PLAINTEXT_EXT_FUNC_CODE   0x01    /* plaintext */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
#define APPLICATION_EXT_FUNC_CODE 0xff    /* application block */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
/******************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
 * O.K., here are the routines one can access in order to decode GIF file:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 * (GIF_LIB file DGIF_LIB.C).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 *****************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
GifFileType *DGifOpenFileName(const char *GifFileName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
GifFileType *DGifOpenFileHandle(int GifFileHandle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
GifFileType *DGifOpen(void *userPtr, InputFunc readFunc);    /* new one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                                                             * (TVT) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
int DGifSlurp(GifFileType * GifFile);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
int DGifGetScreenDesc(GifFileType * GifFile);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
int DGifGetRecordType(GifFileType * GifFile, GifRecordType * GifType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
int DGifGetImageDesc(GifFileType * GifFile);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
int DGifGetLine(GifFileType * GifFile, GifPixelType * GifLine, int GifLineLen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
int DGifGetPixel(GifFileType * GifFile, GifPixelType GifPixel);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
int DGifGetComment(GifFileType * GifFile, char *GifComment);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
int DGifGetExtension(GifFileType * GifFile, int *GifExtCode,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                     GifByteType ** GifExtension);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
int DGifGetExtensionNext(GifFileType * GifFile, GifByteType ** GifExtension);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
int DGifGetCode(GifFileType * GifFile, int *GifCodeSize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                GifByteType ** GifCodeBlock);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
int DGifGetCodeNext(GifFileType * GifFile, GifByteType ** GifCodeBlock);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
int DGifGetLZCodes(GifFileType * GifFile, int *GifCode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
int DGifCloseFile(GifFileType * GifFile);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
#define D_GIF_ERR_OPEN_FAILED    101    /* And DGif possible errors. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
#define D_GIF_ERR_READ_FAILED    102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
#define D_GIF_ERR_NOT_GIF_FILE   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
#define D_GIF_ERR_NO_SCRN_DSCR   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
#define D_GIF_ERR_NO_IMAG_DSCR   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
#define D_GIF_ERR_NO_COLOR_MAP   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
#define D_GIF_ERR_WRONG_RECORD   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
#define D_GIF_ERR_DATA_TOO_BIG   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
#define D_GIF_ERR_NOT_ENOUGH_MEM 109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
#define D_GIF_ERR_CLOSE_FAILED   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
#define D_GIF_ERR_NOT_READABLE   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
#define D_GIF_ERR_IMAGE_DEFECT   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
#define D_GIF_ERR_EOF_TOO_SOON   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
/******************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
 * O.K., here are the routines from GIF_LIB file GIF_ERR.C.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
******************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
extern void PrintGifError(void);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
extern int GifLastError(void);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
/******************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
 * O.K., here are the routines from GIF_LIB file DEV2GIF.C.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
******************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
extern int DumpScreen2Gif(const char *FileName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                          int ReqGraphDriver,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                          long ReqGraphMode1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                          long ReqGraphMode2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                          long ReqGraphMode3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
/*****************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
 * Everything below this point is new after version 1.2, supporting `slurp
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
 * mode' for doing I/O in two big belts with all the image-bashing in core.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
 *****************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
/******************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
 * Color Map handling from ALLOCGIF.C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
 *****************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
extern ColorMapObject *MakeMapObject(int ColorCount,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                                     const GifColorType * ColorMap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
extern void FreeMapObject(ColorMapObject * Object);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
extern int BitSize(int n);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
/******************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
 * Support for the in-core structures allocation (slurp mode).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
 *****************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
/* This is the in-core version of an extension record */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
typedef struct {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    int ByteCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    char *Bytes;    /* on malloc(3) heap */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    int Function;   /* Holds the type of the Extension block. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
} ExtensionBlock;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
/* This holds an image header, its unpacked raster bits, and extensions */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
typedef struct SavedImage {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    GifImageDesc ImageDesc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    unsigned char *RasterBits;  /* on malloc(3) heap */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    int Function;   /* DEPRECATED: Use ExtensionBlocks[x].Function instead */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    int ExtensionBlockCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    ExtensionBlock *ExtensionBlocks;    /* on malloc(3) heap */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
} SavedImage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
extern void MakeExtension(SavedImage * New, int Function);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
extern int AddExtensionBlock(SavedImage * New, int Len,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                             unsigned char ExtData[]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
extern void FreeExtension(SavedImage * Image);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
extern SavedImage *MakeSavedImage(GifFileType * GifFile,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
                                  const SavedImage * CopyFrom);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
extern void FreeSavedImages(GifFileType * GifFile);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
#ifdef __cplusplus
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
#endif /* __cplusplus */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
#endif /* _GIF_LIB_H */