1 /* 2 * OpenBOR - http://www.chronocrash.com 3 * ----------------------------------------------------------------------- 4 * All rights reserved, see LICENSE in OpenBOR root for details. 5 * 6 * Copyright (c) 2004 - 2014 OpenBOR Team 7 */ 8 9 #ifndef ANIGIF_H 10 #define ANIGIF_H 11 12 13 14 15 // Animated GIF player. 16 17 // ============================== This is it! =============================== 18 // Should be something like this... 19 20 21 #define ANIGIF_DECODE_END 0 22 #define ANIGIF_DECODE_FRAME 1 23 #define ANIGIF_DECODE_RETRY 3 24 #define ANIGIF_DECODE_PAL 4 25 26 #define NO_CODE -1 27 28 29 #pragma pack(1) 30 typedef struct 31 { 32 char magic[6]; 33 unsigned short screenwidth, screenheight; 34 unsigned char flags; 35 unsigned char background; 36 unsigned char aspect; 37 } gifheaderstruct; 38 #pragma pack() 39 40 41 #pragma pack(1) 42 typedef struct 43 { 44 short left, top; 45 unsigned short width, height; 46 unsigned char flags; 47 } gifblockstruct; 48 #pragma pack() 49 50 #define anigif_magic 0x464947 51 52 #pragma pack(4) 53 typedef struct 54 { 55 int magic; 56 struct 57 { 58 gifheaderstruct gif_header; 59 int handle; // = -1; 60 int transparent; // = -1; 61 int bitdepth; 62 int numcolours; 63 int lastdelay; 64 int code; 65 u32 nextframe; 66 unsigned char *global_pal; 67 unsigned char *local_pal; 68 } info[3]; 69 int isRGB; 70 int frame; 71 int done; 72 s_screen *backbuffer; 73 s_screen *gifbuffer[3]; 74 } anigif_info; 75 #pragma pack() 76 77 78 //Gif file format should be always the same, so no need to use sizeof 79 #define sizeof_gifheaderstruct 13 80 #define sizeof_iblock 9 81 82 83 // Returns true on succes 84 int anigif_open(char *filename, char *packfilename, anigif_info *info); 85 86 // Decode next frame 87 int anigif_decode_frame(anigif_info *info); 88 89 s_screen *anigif_getbuffer(anigif_info *info); 90 void anigif_close(anigif_info *info); 91 92 #endif 93