gifFile(API)
From EosPedia
DataExpress/gifFile is API for gif file.
constant
#define scdGCT (0x80) #define scdGCTcres (0x70) #define scdGCTsort (0x08) #define scdGCTsize (0x07)
#define imdLCT (0x80) #define imdInterlace (0x40) #define imdLCTsort (0x20) #define imdRESV (0x18) #define imdLCTsize (0x07)
#define OUT_OF_MEMORY -10 #define BAD_CODE_SIZE -20 #define READ_ERROR -1 #define WRITE_ERROR -2 #define OPEN_ERROR -3 #define CREATE_ERROR -4
struct
#define LOCAL static #define IMPORT extern
#define FAST register
typedef short WORD; typedef unsigned short UWORD; typedef char TEXT; typedef unsigned char UTINY; typedef long LONG; typedef unsigned long ULONG; typedef int INT;
typedef struct gifFileHeader { char sig[3]; char ver[3]; } gifFileHeader;
typedef struct gifFileImageDesc { unsigned char id; unsigned short xleft; unsigned short ytop; unsigned short imwidth; unsigned short imheight; unsigned char flags; } gifFileImageDesc;
typedef struct gifFileColorTable { unsigned char r; unsigned char g; unsigned char b; } gifFileColorTable;
typedef struct gifFileImageDefinition { gifFileImageDesc Desc; gifFileColorTable* LCT; } gifFileImageDefinition;
typedef struct gifFileCtrlExtensions { unsigned char id; unsigned char label; unsigned char size; unsigned char flags; unsigned short delay; unsigned char trcrl; } gifFileCtrlExtensions;
typedef struct gifFileCommentExtensions { unsigned char id; unsigned char label; } gifFileCommentExtensions;
typedef struct gifFileTextExtensions { unsigned char id; unsigned char label; unsigned char size; unsigned char xleft; unsigned short ytop; unsigned char txwidth; unsigned char txheight; unsigned char cewidth; unsigned char ceheight; unsigned char fgclr; unsigned short bgclr; } gifFileTextExtensions;
typedef struct gifFileApplicationExtensions { unsigned char id; unsigned char label; unsigned char size; char apname[8]; char apcode[3]; } gifFileApplicationExtensions;
typedef struct gifFile { gifFileHeader Header; gifFileScreenDesc ScrDesc; gifFileColorTable* GCT; long nImage; gifFileImageDefinition* ImageDef; char Tailer; } gifFile;
API
Create gif file
Create from a mrcImage file in to a gif file whose name is out.
extern int lmrc2gif(char* out, mrcImage* in, ColorMapObject* ColorMap, long mode);
Create a color gif file whose name is out
r, g, b: mrcImage file (red, green, blue)
n, nr, ng, nb: (each color gradation: total, red, green, blue)
extern int lmrc2gifColor(char* out, mrcImage* r, mrcImage* g, mrcImage* b, ColorMapObject* ColorMap, int n, int nr, int ng, int nb, long mode);
ColorMapObject
Create new ColorMapObject, and return the pointer.
extern ColorMapObject* gifColorMapInit(int n, long mode);
Set ColorMap->Colors as monochrome n-gradation.
extern ColorMapObject* gifColorMapGrey(ColorMapObject* ColorMap, int n);
Set ColorMap->Colors as color. n, nr, ng, nb: (each color gradation: total, red, green, blue)
extern ColorMapObject* gifColorMapColor(ColorMapObject* ColorMap, int n, int nr, int ng, int nb);