gifFile(API)
提供: Eospedia
DataExpress/gifFileはgifファイルを取り扱うのためのAPI です。
定数
#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
構造体
#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
gifファイルの作成
mrcImageファイルinからファイル名outでgifファイルを作成します。
extern int lmrc2gif(char* out, mrcImage* in, ColorMapObject* ColorMap, long mode);
ファイル名outでgifファイルをカラーで作成します。
r, g, b: mrcImageファイル(赤, 緑, 青))
n, nr, ng, nb: (各色毎の階調: トータル, 赤, 緑, 青)
extern int lmrc2gifColor(char* out, mrcImage* r, mrcImage* g, mrcImage* b, ColorMapObject* ColorMap, int n, int nr, int ng, int nb, long mode);
ColorMapObject
ColorMapObjectを新規作成してポインタを返します。
extern ColorMapObject* gifColorMapInit(int n, long mode);
ColorMap->Colorsをモノクロn階調で定義します。
extern ColorMapObject* gifColorMapGrey(ColorMapObject* ColorMap, int n);
ColorMap->Colorsをカラーで定義します。 n, nr, ng, nb: (各色毎の階調: トータル, 赤, 緑, 青)
extern ColorMapObject* gifColorMapColor(ColorMapObject* ColorMap, int n, int nr, int ng, int nb);