1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
/****************************************************************************\
** Title: GIF.H **
** Purpose: GIF Header file **
** Version: 1.0 **
** Date: March 1992 **
** Author: James D. Murray, Anaheim, CA, USA **
** C Compilers: Borland C++ v2.0, Microsoft C v6.00a **
** **
** This file contains the header structures for the GIF image **
** file format. **
** **
** **
** Copyright (C) 1991 by Graphics Software Labs. All rights reserved. **
\****************************************************************************/
#include "hdf.h"
#ifndef GIF_H
#define GIF_H 1
#define MAX_PAL 768
/*#include "datatype.h" Data type definitions */
typedef uint8 BYTE;
typedef uint16 WORD;
typedef char CHAR;
typedef uint8 boolean;
#define false 0;
#define true 1;
/* Set the EndianOrder.
** The GIF Reader file should do this.
** Set EndianOrder = 0 if machine is little endian
** EndianOrder = 1 if machine is big endian.
*/
extern int EndianOrder;
/*
** The GIF header format.
**
** This structure actually contains the header, logical screen
** descriptor, and the global color table for the GIF image.
*/
typedef struct _GifHeader /* Offset Description */
{
BYTE PackedField; /* 0Ah Color Information */
WORD TableSize;
BYTE ImageCount; /* Keep a count of the number of images */
BYTE CommentCount;
BYTE ApplicationCount;
BYTE PlainTextCount;
BYTE HDFPalette[256][3];
BYTE HeaderDump[6]; /* BYTE array to dump header contents */
BYTE LSDDump[7]; /* Logical Screen Descriptor dump */
} GIFHEAD;
/*
** The GIF Image Descriptor.
*/
typedef struct _GifImageDescriptor {
WORD ImageWidth; /* Width of the image in pixels */
WORD ImageHeight; /* Height of the image in pixels */
BYTE PackedField; /* Image and Color Table Data Information */
WORD TableSize;
WORD CodeSize; /* Minimum LZW CodeSize for image data */
BYTE HDFPalette[256][3];
BYTE GIDDump[9]; /* GifImageDescriptor dump */
BYTE *Image; /* Decompressed Raster Image */
BYTE *GIFImage;
} GIFIMAGEDESC;
/*
** GIF 89a Graphic Control Extension Block
*/
typedef struct _GifGraphicControlExtension {
BYTE GCEDump[5]; /* Graphic Control Extension Dump */
} GIFGRAPHICCONTROL;
/*
** GIF 89a Plain Text Extension Block
*/
typedef struct _GifPlainTextExtension {
BYTE PTEDump[15]; /* Plain Text Extension Dump */
BYTE *PlainTextData; /* Plain Text data sub-blocks */
WORD DataSize;
} GIFPLAINTEXT;
/*
** GIF 89a Application Extension Block
*/
typedef struct _GifApplicationExtension {
BYTE AEDump[14]; /* Application Extension Dump */
BYTE *ApplicationData; /* Application data sub-blocks */
WORD DataSize;
} GIFAPPLICATION;
/*
** GIF 89a Comment Extension Block
*/
typedef struct _GifCommentExtension {
BYTE CEDump[2]; /* Comment Extension Dump */
BYTE *CommentData; /* Comment data sub-blocks */
WORD DataSize;
BYTE Terminator; /* Block Terminator (always 0) */
} GIFCOMMENT;
/*
** GIF to HDF Memory Struct
** Purpose : The gif to hdf structure is used to pass all the
** gif data to the memory, which gets caught by the hdf driver
** Its the drivers job to put the data in the appropriate places
** in the HDF file.
** I have assumed that the ImageDescriptors and GraphicControls follow
** one another, ie. I have not associated them with each other. The driver
** must assume a 1-1 correspondence. The same discussion with plain text
** extension.
*/
typedef struct _GifToMem {
GIFHEAD *GifHeader;
GIFIMAGEDESC **GifImageDesc;
GIFGRAPHICCONTROL **GifGraphicControlExtension;
GIFPLAINTEXT **GifPlainTextExtension;
GIFAPPLICATION **GifApplicationExtension;
GIFCOMMENT **GifCommentExtension;
} GIFTOMEM;
/*
** Function Prototypes
*/
/* GIF2MEM.C */
GIFTOMEM Gif2Mem(BYTE *);
/* GIFREAD.C */
int ReadGifHeader(GIFHEAD *, BYTE **);
int ReadGifImageDesc(GIFIMAGEDESC *, BYTE **);
int ReadGifGraphicControl(GIFGRAPHICCONTROL *, BYTE **);
int ReadGifPlainText(GIFPLAINTEXT *, BYTE **);
int ReadGifApplication(GIFAPPLICATION *, BYTE **);
int ReadGifComment(GIFCOMMENT *, BYTE **);
/* WRITEHDF.C */
int WriteHDF(GIFTOMEM, CHAR *, CHAR *);
BYTE *ReadDataSubBlocks(BYTE **, WORD *);
BYTE *Decompress(GIFIMAGEDESC *, GIFHEAD *);
BYTE GetByte(BYTE *);
WORD GetWord(BYTE *);
#endif /* GIF_H */
|