Basic ani file extracting.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@158 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
#include <stdint.h>
|
||||
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned int uint32;
|
||||
typedef short int16;
|
||||
|
||||
#define MAKE_WORD(x1, x2) (((x2) << 8) | (x1))
|
||||
#define MAKE_DWORD(x1, x2, x3, x4) (((x4) << 24) | ((x3) << 16) | \
|
||||
((x2) << 8) | (x1))
|
||||
|
||||
typedef struct {
|
||||
int16 x;
|
||||
int16 y;
|
||||
} hotspot_type;
|
||||
|
||||
typedef struct {
|
||||
uint16 w;
|
||||
uint16 h;
|
||||
} bounds_type;
|
||||
|
||||
typedef struct {
|
||||
uint16 index; // only first 12 bits used
|
||||
uint8 plut;
|
||||
uint8 flags;
|
||||
hotspot_type hotspot;
|
||||
bounds_type bounds;
|
||||
// uint32 len;
|
||||
const uint8 *start;
|
||||
} frame_desc;
|
||||
|
||||
typedef struct {
|
||||
uint16 num_frames; // only first 12 bits used
|
||||
frame_desc *frames;
|
||||
} index_header;
|
||||
|
||||
#define FTYPE_SHIFT 12
|
||||
#define FINDEX_MASK ((1 << FTYPE_SHIFT) - 1)
|
||||
#define FTYPE_MASK (0xffff & ~FINDEX_MASK)
|
||||
|
||||
#define TYPE_GET(f) ((f) & FTYPE_MASK)
|
||||
#define INDEX_GET(f) ((f) & FINDEX_MASK)
|
||||
|
||||
#define FLAG_DATA_HARDWARE (1 << 4)
|
||||
#define FLAG_DATA_COPY (1 << 5)
|
||||
#define FLAG_DATA_PACKED (1 << 6)
|
||||
#define FLAG_X_FLIP (1 << 7)
|
||||
|
||||
#define PACK_EOL 0
|
||||
#define PACK_LITERAL 1
|
||||
#define PACK_TRANS 2
|
||||
#define PACK_REPEAT 3
|
||||
#define PACK_SHIFT 6
|
||||
#define PACK_TYPE(c) ((uint8) ((c) >> PACK_SHIFT))
|
||||
#define PACK_COUNT(c) ((uint8) (((c) & ((1 << PACK_SHIFT) - 1)) + 1))
|
||||
|
||||
Reference in New Issue
Block a user