📄 fad.h
字号:
/** * libFAD is the legal property of its developers, whose names are too numerous * to list here. Please refer to the COPYRIGHT file distributed with this * source distribution. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: fad.h,v 1.53 2006/03/22 01:44:59 wrxzzj Exp $ */#ifndef __FAD_H#define __FAD_H#include <stdio.h>#include <stdlib.h>#include <string.h>/**include cairo header*/#include <cairo.h>#ifdef __cplusplsuextern "C" {#endif#ifdef LIBFAD_DEBUG#define FAD_ERROR(...) fprintf(stderr, "[XXX] "__VA_ARGS__)#define FAD_DEBUG(...) fprintf(stdout, "[III] "__VA_ARGS__)#else#define FAD_ERROR#define FAD_DEBUG#endif#define FAD_PUBLISHYEAR "2005 - 2006"#define FAD_AUTHOR "VG System Technologies, Inc."#define FAD_MAJOR_VER 0#define FAD_MINOR_VER 9#define FAD_MICRO_VER 3#define FAD_CLIPSTACK_MAX 4typedef unsigned char u8_t;typedef unsigned short u16_t;typedef unsigned int u32_t;typedef signed char s8_t;typedef signed short s16_t;typedef signed int s32_t;typedef signed int twip_t;typedef s32_t sbit_t;typedef u32_t ubit_t;typedef s32_t fbit_t;typedef struct { u8_t r, g, b, a;} rgba_t;typedef struct { twip_t x0, y0, x1, y1;} rect_t;typedef struct { s16_t rm, gm, bm, ra, ga, ba;} rgbxform_t;typedef struct { rgbxform_t base; s16_t am, aa;} rgbaxform_t;enum { /**mouse button event*/ FAD_EVT_MBUP, FAD_EVT_MBDOWN, FAD_EVT_MBMOTION, /**keyboard event*/ FAD_EVT_KBUP, FAD_EVT_KBDOWN};typedef enum { FAD_ERROR_MEM = 0x8000, FAD_ERROR_BUFLEN, FAD_ERROR_FORMAT, FAD_ERROR_IO, FAD_ERROR_ZLIB, FAD_ERROR_TAG, FAD_ERROR_NONE = 0, FAD_OK = 0} fad_error_t;typedef enum { FAD_STA_INIT = 0x00, FAD_STA_DOTAG = 0x01, FAD_STA_DORENDER = 0x02, FAD_STA_FINISH = 0x03, FAD_STA_END = 0x04, FAD_STA_STOP = 0x05, FAD_STA_SEEK = 0x06, FAD_STA_UPDATEBTN = 0x07} fad_status_t;typedef struct _fad_frame_s fad_frame_t;typedef struct _fad_render_s fad_render_t;typedef struct _fad_object_s fad_object_t;typedef struct _dl_node_s dl_node_t;typedef struct _dl_header_s dl_header_t;typedef struct _dynarray_s dynarray_t;typedef struct _bits_s bits_t;/**dynamic array for manage dictionary*/struct _dynarray_s { void** array; u16_t step, ref; u16_t total, count; void (* put)(dynarray_t* da, void* ptr, u16_t idx); void* (* get)(dynarray_t* da, u16_t idx);};/**single list for manager display list*/struct _list_s { struct _slist_s* next; void* data;};/**bit stream for parse SWF tag*/struct _bits_s { u8_t npad; u8_t *bufptr;};/**common object*/struct _fad_object_s { u8_t type; dl_node_t *node; /**invoked by mouse button event*/ s32_t (* proc_mbevt)(fad_object_t *fo, u8_t evt, s32_t x, s32_t y); u8_t (* do_render)(fad_object_t* fo, fad_render_t* render, dl_node_t* node); void (* do_free)(fad_object_t* fo); /**object copy for sprite*/ fad_object_t* (* do_copy)(fad_object_t *fo); /**get image data, for JPEG/Bits TAGS*/ void* (* get_image)(fad_object_t* fo, u32_t* w, u32_t* h); /**get fad object bound rectangle*/ void (* get_rect)(fad_object_t *fo, rect_t *rt);};/**display list node*/struct _dl_node_s { fad_object_t *fo; u16_t depth, ratio; u8_t flag, attr; rect_t rt; cairo_matrix_t mx; rgbaxform_t cx; u8_t* ctx; dl_node_t* next;};/**display list header*/struct _dl_header_s { u16_t count; dl_node_t* hdr; void (* put)(struct _dl_header_s *hdr, dl_node_t *node); dl_node_t* (* get)(struct _dl_header_s *hdr, u16_t depth); dl_node_t* (* rmv)(struct _dl_header_s *hdr, u16_t depth);};struct _fad_frame_s { /**public attribute*/ u8_t r, g, b; /**private attribute*/ u8_t attr; /**swf file header*/ rect_t size;#ifdef LIBFAD_DIRTY_AREA rect_t dirty_rect;#endif u16_t rate, total_frame, output_frame; s16_t nbtn; /**clip stack*/ s8_t nclip; s16_t clipstack[FAD_CLIPSTACK_MAX]; dl_header_t dlhdr; fad_render_t *render; fad_status_t sta; /**jpeg tables*/ u8_t* jt_buf; u32_t jt_size; /**event sound id*/ u16_t es_id; /**event sound info*/ u8_t *es_si;#ifdef LIBFAD_AS2 u8_t *asr;#endif /**stream sound attribute*/ u8_t ss_attr; /**stream sound data*/ s32_t ss_nsize; u8_t *ss_buff; /**mouse button event callback*/ s32_t (* proc_mbevt)(fad_frame_t *frame, u8_t evt, s32_t x, s32_t y); /**keyboard event callback*/ s32_t (* proc_kbevt)(fad_frame_t *frame, u8_t evt, u32_t keycode); void (* update)(void *surface, s32_t x, s32_t y, s32_t w, s32_t h); void *priv_surface; void *priv;};typedef struct { u8_t version; u16_t tag_id; u32_t tag_len; u8_t* bufbeg; bits_t bits; dynarray_t* dict; fad_error_t err;} fad_stream_t;struct _fad_render_s { cairo_t *cr; u8_t sndattr; s32_t snddev;};/**stream functions*/void fad_stream_init(fad_stream_t* s, dynarray_t* dict);void fad_stream_finish(fad_stream_t* s);void fad_stream_stdio(fad_stream_t* s, FILE* infile);void fad_stream_buffer(fad_stream_t* s, u8_t* buffer);/**frame functions*/void fad_frame_init(fad_frame_t* frame);void fad_frame_finish(fad_frame_t* frame);s32_t fad_frame_decode(fad_frame_t* frame, fad_stream_t* s);s32_t fad_frame_seek(fad_frame_t *frame, fad_stream_t *s, s32_t idx);void fad_frame_render_movie(fad_frame_t* frame);void fad_frame_render_audio(fad_frame_t* frame, fad_stream_t *stream);void fad_frame_render_actionscript(fad_frame_t* frame, fad_stream_t *stream);void fad_frame_set_update_callback(fad_frame_t *frame, void (* update)(void *, s32_t, s32_t, s32_t ,s32_t), void *surface);#ifdef __cplusplus}#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -